Esempio n. 1
0
 public IState DoState(DragonStateMachine stateMachine)
 {
     if (!stateMachine.GetIsDieAnim())
     {
         DoDeathState(stateMachine);
     }
     return(this);
 }
Esempio n. 2
0
 public IState DoState(DragonStateMachine stateMachine)
 {
     DoGetHit(stateMachine);
     if (stateMachine.enemy.conditions.isDead)
     {
         return(stateMachine.deathState);
     }
     else
     {
         return(stateMachine.pursuitState);
     }
 }
Esempio n. 3
0
        private void DoShooting(DragonStateMachine stateMachine)
        {
            stateMachine.SetShootAnim(true);

            if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) > stateMachine.enemy.stats.ShootingRange)
            {
                stateMachine.enemy.conditions.isShootingRange = false;
                stateMachine.enemy.conditions.canShoot        = false;
                stateMachine.StopCoroutine("CounterToIsShootOn");
                stateMachine.enemy.conditions.isWait = false;
                stateMachine.SetShootAnim(false);
            }
        }
Esempio n. 4
0
        private void DoDeathState(DragonStateMachine stateMachine)
        {
            stateMachine.enemy.hpIndicator.UpdateHp();
            stateMachine.navAgent.isStopped = true;
            stateMachine.navAgent.velocity  = Vector3.zero;
            stateMachine.enemy.SetNewDamageIndicator();
            stateMachine.enemy.ParticleDamaged();
            stateMachine.SetTriggerDieAnim();
            stateMachine.SetIsDieAnim(true);
            stateMachine.childrenCollider.enabled = true;

            stateMachine.enemy.conditions.isAttacking   = false;
            stateMachine.enemy.conditions.isChasing     = false;
            stateMachine.enemy.conditions.isAttackRange = false;
            stateMachine.enemy.conditions.isHitten      = false;
            stateMachine.enemy.conditions.isDead        = true;
        }
Esempio n. 5
0
        private void DoGetHit(DragonStateMachine stateMachine)
        {
            if (!GameManager.Instance.soundManager.isPlaying("DragonGetHit"))
            {
                GameManager.Instance.soundManager.Play("DragonGetHit");
            }
            stateMachine.navAgent.isStopped = true;
            stateMachine.navAgent.velocity  = Vector3.zero;
            stateMachine.SetTriggerGetHitAnim();
            stateMachine.enemy.SetNewDamageIndicator();
            stateMachine.enemy.ParticleDamaged();

            stateMachine.enemy.stats.CurrentHp -= stateMachine.enemy.cuantity;
            stateMachine.enemy.hpIndicator.UpdateHp();

            stateMachine.enemy.conditions.isWait   = true;
            stateMachine.enemy.conditions.isHitten = false;
        }
Esempio n. 6
0
 public IState DoState(DragonStateMachine stateMachine)
 {
     DoPursuit(stateMachine);
     if (stateMachine.enemy.conditions.canShoot)
     {
         return(stateMachine.shootingState);
     }
     else if (stateMachine.enemy.conditions.isHitten)
     {
         return(stateMachine.getHitState);
     }
     else if (stateMachine.enemy.conditions.isDead)
     {
         return(stateMachine.deathState);
     }
     else
     {
         return(stateMachine.pursuitState);
     }
 }
Esempio n. 7
0
        public IState DoState(DragonStateMachine stateMachine)
        {
            DoShooting(stateMachine);

            if (stateMachine.enemy.conditions.isDead)
            {
                return(stateMachine.deathState);
            }
            else if (stateMachine.enemy.conditions.isHitten)
            {
                return(stateMachine.getHitState);
            }
            else if (stateMachine.enemy.conditions.isChasing)
            {
                return(stateMachine.pursuitState);
            }
            else
            {
                return(this);
            }
        }
Esempio n. 8
0
 private void DoPursuit(DragonStateMachine stateMachine)
 {
     stateMachine.navAgent.isStopped = false;
     if (stateMachine.navAgent.destination != GameManager.Instance.player.transform.position)
     {
         stateMachine.navAgent.SetDestination(GameManager.Instance.player.transform.position);
     }
     if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) <= stateMachine.enemy.stats.ShootingRange)
     {
         stateMachine.enemy.conditions.isShootingRange = true;
         stateMachine.enemy.conditions.isChasing       = false;
         stateMachine.ShootingMonobehaviour();
     }
     else if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) > stateMachine.enemy.stats.ShootingRange)
     {
         stateMachine.enemy.conditions.isShootingRange = false;
         stateMachine.enemy.conditions.canShoot        = false;
         stateMachine.StopCoroutine("CounterToIsShootOn");
         stateMachine.enemy.conditions.isWait = false;
     }
 }