Beispiel #1
0
 public override void EnablePowerUp()
 {
     base.EnablePowerUp();
     CancelInvoke();
     _animator.SetInteger("state", (int)AnimationStates.Action2);
     NavEntity.SetSpeed(
         GameController.Instance.PLAYER_DEFAULT_SPEED *
         GameController.Instance.KNIGHT_POWERUP_SPEED_MUL);
 }
Beispiel #2
0
 public override void DisablePowerUp()
 {
     base.DisablePowerUp();
     _animator.SetInteger("state", (int)AnimationStates.Idle);
     NavEntity.SetSpeed(GameController.Instance.PLAYER_DEFAULT_SPEED);
     if (_fireKnivesCoroutine != null)
     {
         StopCoroutine(_fireKnivesCoroutine);
     }
 }
Beispiel #3
0
 public override void EnablePowerUp()
 {
     base.EnablePowerUp();
     _animator.SetInteger("state", (int)AnimationStates.Action2);
     NavEntity.SetSpeed(
         GameController.Instance.PLAYER_DEFAULT_SPEED *
         GameController.Instance.MAGE_POWERUP_SPEED_MUL);
     _lastNodeIndexes = new Vector2(
         NavEntity.LastIndexes.Item1,
         NavEntity.LastIndexes.Item2);
 }
Beispiel #4
0
 public override void EnablePowerUp()
 {
     base.EnablePowerUp();
     NavEntity.SetSpeed(GameController.Instance.PLAYER_DEFAULT_SPEED *
                        GameController.Instance.ELF_POWERUP_SPEED_MUL);
     _animator.SetInteger("state", (int)AnimationStates.Action2);
     if (_fireKnivesCoroutine != null)
     {
         StopCoroutine(_fireKnivesCoroutine);
     }
     _fireKnivesCoroutine = StartCoroutine(FireKnives());
 }
Beispiel #5
0
        public override void Initialize(int x, int y)
        {
            base.Initialize(x, y);

            CanBeDamaged = false;
            IsDead       = false;
            CancelInvoke();
            NavEntity.DisableMoving();
            DisablePowerUp();
            _animator.SetInteger("state", (int)AnimationStates.Idle);
            MovementDirection = MovementDirections.Left;
            NavEntity.SetSpeed(GameController.Instance.PLAYER_DEFAULT_SPEED);
        }
Beispiel #6
0
        public override void Initialize(int x, int y)
        {
            base.Initialize(x, y);

            ActionState  = EnemyActionState.Waiting;
            Life         = GameController.Instance.MEDIUM_LIFE;
            IsDead       = false;
            CanBeDamaged = false;
            CanDamage    = false;
            _animator.SetInteger("state", (int)AnimationStates.Idle);
            NavEntity.SetSpeed(GameController.Instance.ENEMY_MEDIUM_SPEED);
            NavEntity.DisableMoving();
            CancelInvoke();
        }
Beispiel #7
0
 private void CompleteDodge()
 {
     if (PowerUpIsActive)
     {
         NavEntity.SetSpeed(
             GameController.Instance.PLAYER_DEFAULT_SPEED *
             GameController.Instance.ELF_POWERUP_SPEED_MUL);
     }
     else
     {
         NavEntity.SetSpeed(GameController.Instance.PLAYER_DEFAULT_SPEED);
         _animator.SetInteger("state", (int)AnimationStates.Idle);
         CanBeDamaged = true;
     }
 }
Beispiel #8
0
        protected override void Update()
        {
            if (IsDead)
            {
                return;
            }

            if (Input.GetKeyDown(KeyCode.Space) && SkillIsReady && !PowerUpIsActive)
            {
                //perform dodge
                CanBeDamaged = false;
                NavEntity.SetSpeed(
                    GameController.Instance.PLAYER_DEFAULT_SPEED *
                    GameController.Instance.ELF_DODGE_SPEED);
                _animator.SetInteger("state", (int)AnimationStates.Action1);
                Invoke("CompleteDodge", GameController.Instance.ELF_DODGE_DURATION);

                MovementDirections oppositeDirection = MovementDirections.None;
                switch (MovementDirection)
                {
                case MovementDirections.Up:
                    oppositeDirection = MovementDirections.Down;
                    break;

                case MovementDirections.Down:
                    oppositeDirection = MovementDirections.Up;
                    break;

                case MovementDirections.Left:
                    oppositeDirection = MovementDirections.Right;
                    break;

                case MovementDirections.Right:
                    oppositeDirection = MovementDirections.Left;
                    break;
                }
                var arrow = Instantiate(_arrowPrefab).GetComponent <Arrow>();
                arrow.Initialize(transform.position, oppositeDirection);
                GameEvents.Instance.OnPlayerUsedSkill(new GameEvents.OnPlayerUsedSkillEventArgs());
            }

            base.Update();
        }
Beispiel #9
0
 public override void DisablePowerUp()
 {
     base.DisablePowerUp();
     _animator.SetInteger("state", (int)AnimationStates.Idle);
     NavEntity.SetSpeed(GameController.Instance.PLAYER_DEFAULT_SPEED);
 }