using System; using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; public class PlayerIdleState : PlayerState { public PlayerIdleState(Player player) : base(player) { } public override void Enter() { base.Enter(); anim.SetBool("isIdle", true); rb.linearVelocity = new Vector2(0f, rb.linearVelocity.y); } public override void Update() { base.Update(); if(AttackPressed && combat.CanAttack) player.ChangeState(player.attackState); else if (JumpPressed) { JumpPressed = false; player.ChangeState(player.jumpState); } else if (Mathf.Abs(player.moveInput.x) > 0.1f) { player.ChangeState(player.moveState); } else if (MoveInput.y < -0.1f) { player.ChangeState(player.crouchState); } } public override void Exit() { base.Exit(); anim.SetBool("isIdle", false); } }