コード例 #1
0
        public void Update(GameManager game)
        {
            if (state.isMoving())
            {
                state.Move();
            }
            state.Update(game);

            if (attack == true)
            {
                AttackCount++;
                if (AttackCount > AttackTimer)
                {
                    attack      = false;
                    AttackCount = 0;
                }
            }
            if (health <= 0)
            {
                game.SetState(3);
            }
            if (state is WinPlayerState)
            {
                game.SetState(4);
            }
        }
コード例 #2
0
 public void Update()
 {
     _state.Move();
     time += Time.deltaTime;
     if (time > 5f)
     {
         if (Isruning)
         {
             _state   = new Walk(_velocity * 0.5f, transform);
             Isruning = false;
         }
         else
         {
             _state   = new Run(_velocity, transform);
             Isruning = true;
         }
         time = 0;
     }
 }
コード例 #3
0
ファイル: Player.cs プロジェクト: Group4-CSE/Zelda
        public void Update(GameManager game)
        {
            //int delay = 0;
            if (state.isMoving())
            {
                state.Move();
            }
            state.Update(game);

            if (attack == true)
            {
                AttackCount++;
                if (AttackCount > AttackTimer)
                {
                    attack      = false;
                    AttackCount = 0;
                }
            }
            //Low Health Sounds
            if (health <= 2)
            {
                //Delay to keep sound as beep rather than eeeeee

                delay++;

                if (delay == 20)
                {
                    sound1.lowHP();
                    delay -= 20;
                }
            }
            if (health <= 0)
            {
                sound1.pDies();
                game.SetState(3);
            }

            if (state is WinPlayerState)
            {
                game.SetState(4);
            }
        }
コード例 #4
0
ファイル: Context.cs プロジェクト: MatasGos/BMAN
 public void Move()
 {
     currentState.Move(this);
 }