public PlayerControl(King player, IGameInputWithDPad input) { Input = input; Player = player; Player.Scene.AddObject(this); var walk = new AxisMotion(Config.ReadValue <AxisMotionConfig>("walk")); var brake = new AxisMotion(Config.ReadValue <AxisMotionConfig>("brake")); var climb = new AxisMotion(Config.ReadValue <AxisMotionConfig>("climb")); var climbBrake = new AxisMotion(Config.ReadValue <AxisMotionConfig>("climb brake")); WalkMotion = new MotionWithBrake(walk, brake); player.Motion.AddAdjuster(WalkMotion); ClimbMotion = new MotionWithBrake(climb, climbBrake); player.Motion.AddAdjuster(ClimbMotion); JumpMotion = new AxisMotion(Config.ReadValue <AxisMotionConfig>("jump")); player.Motion.AddAdjuster(JumpMotion); hasLandedOnGround = new CollisionCondition <IPlatformerObject, TileMap>(player) .When(player.IsOnGround) .SetActiveTime(new ConfigValue <TimeSpan>("landing time"), player); isAttacking = new InputCondition(GameKeys.Attack, Input) .ContinueWhile(player.Animations.IsAnimationPlaying(AnimationKeys.Attack)); new AnimationController <King>(Player, isAttacking, hasLandedOnGround); Player.Direction = Direction.Right; }
void Btn_Home_Click(object sender, EventArgs e) { if (Card_flag) { AxisMotion a = AxisMotion.axis_motion; a.StartHome(); //AxisMotion.StartHome(); while (!AxisMotion.HomeFinish) { ; } //AxisMotion.StopHome(); a.StopHome(); } else { SetText("请初始化板卡!", -1); } }