当前位置: 首页>>代码示例>>C#>>正文


C# Player.Jump方法代码示例

本文整理汇总了C#中Player.Jump方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Jump方法的具体用法?C# Player.Jump怎么用?C# Player.Jump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.Jump方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleInput

 public override State HandleInput(Player player, StateInput input)
 {
     switch (input)
     {
         case StateInput.LeftKeyPress:
             if (Math.Abs(player.velocity.X) >= (player.maxSpeed * 0.75f))
                 return new Running(-1);
             direction = Direction.Left;
             player.flip = SpriteEffects.FlipHorizontally;
             break;
         case StateInput.RightKeyPress:
             if (Math.Abs(player.velocity.X) >= (player.maxSpeed * 0.75f))
                 return new Running(1);
             direction = Direction.Right;
             player.flip = SpriteEffects.None;
             break;
         case StateInput.AttackKeyPress:
             return new Attacking(this);
         case StateInput.AnimEnd:
             break;
         case StateInput.UpKeyPress:
             player.Jump(1);
             return new Jumping((int)direction);
         default:
             break;
     }
     if (direction == Direction.Null && player.velocity.X == 0)
         return new Idle();
     return base.HandleInput(player, input, this);
 }
开发者ID:AaronCC,项目名称:Dread-Dungeon,代码行数:30,代码来源:Walking..cs

示例2: EnterState

 public void EnterState(Player player)
 {
     if (player.GetMoveController().isStunned == false)
     {
         player.Jump();
         player.SetIsGrounded(false);
     }
 }
开发者ID:spellman235,项目名称:HandScan,代码行数:8,代码来源:JumpState.cs

示例3: EnterState

    public void EnterState(Player player)
    {
        if (!player.GetMoveController().isStunned && !player.attackController.GetIsAttack())
        {
            player.Jump();
            //player.SetIsGrounded(false);

            //player.animator.SetBool("IsJumping", true);
            //player.animator.SetBool("IsGrounded", false);
           }
    }
开发者ID:DevelopersGuild,项目名称:Castle-Bashers,代码行数:11,代码来源:JumpState.cs

示例4: Update

 public override void Update(Player player, GameTime gameTime)
 {
     if (immuneTimer == 0)
     {
         player.Jump(0.4f);
         player.velocity.X = 0;
     }
         
     immuneTimer += gameTime.ElapsedGameTime.Milliseconds;
     blinkTimer += gameTime.ElapsedGameTime.Milliseconds;
     if (blinkTimer >= BLINK_CLOCK)
     {
         blink = !blink;
         blinkTimer = 0f;
     }
     if (immuneTimer >= IMMUNE_CLOCK)
     {
         player.effectState = null;
     }
 }
开发者ID:AaronCC,项目名称:Dread-Dungeon,代码行数:20,代码来源:Immune.cs

示例5: HandleInput

 public override State HandleInput(Player player, StateInput input)
 {
     switch (input)
     {
         case StateInput.UpKeyPress:
             player.Jump(1);
             return new Jumping(0);
         case StateInput.AnimEnd:
             if (player.velocity.X > 9)
                 return new Running(0);
             else if (player.velocity.X != 0)
                 return new Walking(0);
             else
                 return new Idle();
         case StateInput.AttackKeyPress:
             return new Attacking(this);
         default:
             break;
     }
     return base.HandleInput(player, input, this);
 }
开发者ID:AaronCC,项目名称:Dread-Dungeon,代码行数:21,代码来源:Landing.cs

示例6: HandleInput

 public override State HandleInput(Player player, StateInput input)
 {
     switch(input)
     {
         case StateInput.LeftKeyPress:
             return new Walking(-1);
         case StateInput.RightKeyPress:
             return new Walking(1);
         case StateInput.UpKeyPress:
             player.Jump(1);
             return new Jumping(0);
         case StateInput.Hit:
             player.TakeHit(1);
             break;
         case StateInput.AttackKeyPress:
             return new Attacking(this);
         default:
             break;
     }
     return base.HandleInput(player, input, this);
 }
开发者ID:AaronCC,项目名称:Dread-Dungeon,代码行数:21,代码来源:Idle.cs

示例7: HandleInput

        public override State HandleInput(Player player, StateInput input)
        {
            switch (input)
            {
                case StateInput.UpKeyPress:
                    player.Jump(1);
                    return new Jumping((int)direction);
                case StateInput.AnimEnd:
                    break;
                case StateInput.AttackKeyPress:
                    return new Attacking(this);
                default:
                    break;
            }
            if (direction == Direction.Null && player.velocity.X == 0)
            {
                return new Idle();
            }

            if (player.velocity.Y > player.gravityAcceleration * 4)
                return new Falling(direction);

            return base.HandleInput(player, input, this);
        }
开发者ID:AaronCC,项目名称:Dread-Dungeon,代码行数:24,代码来源:Running.cs

示例8: Execute

 public void Execute(Player player)
 {
     player.Jump();
 }
开发者ID:Wikzo,项目名称:gameprogrammingpatterns,代码行数:4,代码来源:JumpCommand.cs

示例9: Execute

 public void Execute(Player p)
 {
     p.Jump();
 }
开发者ID:Wikzo,项目名称:gameprogrammingpatterns,代码行数:4,代码来源:JumpCommand.cs

示例10: HandleInput

        public void HandleInput(InputState input, Player player)
        {
            PlayerIndex playerIndex;

            if (!CharacterPhysics.OnLadder(player))
            {
                if (moveLeft.Evaluate(input, ControllingPlayer, out playerIndex))
                {
                    if (run.Evaluate(input, ControllingPlayer, out playerIndex) && moveLeft.Evaluate(input, ControllingPlayer, out playerIndex))
                    {
                        player.RunLeft();
                    }
                    else
                    {
                        player.WalkLeft();
                    }
                }
                else if (moveRight.Evaluate(input, ControllingPlayer, out playerIndex))
                {
                    if (run.Evaluate(input, ControllingPlayer, out playerIndex) && moveRight.Evaluate(input, ControllingPlayer, out playerIndex))
                    {
                        player.RunRight();
                    }
                    else
                    {
                        player.WalkRight();
                    }
                }
                else
                {
                    player.Stop();
                }
                if (jump.Evaluate(input, ControllingPlayer, out playerIndex))
                {
                    if (player.state == Constants.CharacterState.Jumping)
                    {
                        player.DoubleJump();
                    }
                    else
                        player.Jump();
                }
                if (useSkillCombo.Evaluate(input, ControllingPlayer, out playerIndex))
                {
                    player.UseSkillCombo();
                }
                else if (useSkill0.Evaluate(input, ControllingPlayer, out playerIndex))
                {
                    player.UseSkill(0);
                }
            }
            else if(player.state == Constants.CharacterState.Climbing)
            {
                if (moveUp.Evaluate(input, ControllingPlayer, out playerIndex))
                {
                    player.Climb(Constants.DirectionY.Up);
                }
                else if (moveDown.Evaluate(input, ControllingPlayer, out playerIndex))
                {
                    player.Climb(Constants.DirectionY.Down);
                }
                else
                    player.Climb(Constants.DirectionY.Hold);
            }
        }
开发者ID:Raunio,项目名称:Bearventure,代码行数:64,代码来源:InputHandler.cs


注:本文中的Player.Jump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。