public override HeroState HandleInput(HeroMover hero, IInput input) { if (hero.IsReady2Kick2Left(input)) { return(new StateKick(toRight: false)); } if (hero.IsReady2Kick2Right(input)) { return(new StateKick(toRight: true)); } if (input.GetButtonDown(ButtonCode.Jump)) { if (hero.CanJumpInAir) { return(new StateJump(fromGround: false)); } } if (hero.KeyDirection == 1 && !right) { right = true; hero.SetAnim("fall"); } else if (hero.KeyDirection == -1 && right) { right = false; hero.SetAnim("fall"); } return(this); }
public override HeroState HandleInput(HeroMover hero, IInput input) { if (hero.IsReady2Kick2Left(input)) { return(new StateKick(toRight: false)); } if (hero.IsReady2Kick2Right(input)) { return(new StateKick(toRight: true)); } if (hero.CanJumpInAir && input.GetButtonDown(ButtonCode.Jump)) { return(new StateJump(fromGround: false)); } SetDir(CalcDir(hero), hero); return(this); }