コード例 #1
0
ファイル: Patrol.cs プロジェクト: Chac415/GameEngineWork
 public void Enter(T entity)
 {
     if (MoveSpeed <= 0)
     {
         Animator.ChangeActiveAnimation("left");
         MoveSpeed = -1.4f;
     }
     else if (MoveSpeed >= 0)
     {
         Animator.ChangeActiveAnimation("right");
         MoveSpeed = 1.4f;
     }
 }
コード例 #2
0
 public void Enter(T entity)
 {
     Player.mind.Timer = 0;
     Player.healthScript.TakeDamage(1);
     Animations.ChangeActiveAnimation("Walking_Left");
     //Play Audio for damage sound --------- sound.Playsnd("");
 }
コード例 #3
0
ファイル: PlayerMind.cs プロジェクト: Chac415/GameEngineWork
        public virtual void OnNewKeyInput(object source, KeyEventData data)
        {
            keyState = data._newKey;

            Animations.ChangeActiveAnimation(IdleState);


            if (keyState.IsKeyDown(Keys.D) || keyState.IsKeyDown(Keys.Right))
            {
                Animations.ChangeActiveAnimation("Walking_Right");
                speed          = 2.5f;
                IdleState      = "Idle_Right";
                body.Position += new Vector2(speed, 0);
            }

            if (keyState.IsKeyDown(Keys.A) || keyState.IsKeyDown(Keys.Left))
            {
                Animations.ChangeActiveAnimation("Walking_Left");
                speed          = -2.5f;
                IdleState      = "Idle_Left";
                body.Position += new Vector2(speed, 0);
            }

            if (canClimb && keyState.IsKeyDown(Keys.W) || keyState.IsKeyDown(Keys.Up))
            {
                speed          = -5f;
                body.Position += new Vector2(0, speed);
                Animations.ChangeActiveAnimation("Climbing");
                sound.Playsnd("Ladder", 0.3f, true);
            }
            if (canClimb && keyState.IsKeyDown(Keys.S) || keyState.IsKeyDown(Keys.Down))
            {
                speed          = 5f;
                body.Position += new Vector2(0, speed);
                Animations.ChangeActiveAnimation("Climbing");
                sound.Playsnd("Ladder", 0.3f, true);
            }
        }