Example #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);
            }
        }
Example #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;
     }
 }
Example #3
0
        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);
            }
        }
Example #4
0
 public void Move()
 {
     currentState.Move(this);
 }