예제 #1
0
 public IState DoState(PlantStateMachine stateMachine)
 {
     if (!stateMachine.GetIsDieAnim())
     {
         DoDeathState(stateMachine);
     }
     return(this);
 }
예제 #2
0
 private void DoIdle(PlantStateMachine stateMachine)
 {
     stateMachine.SetIdleAnim(true);
     stateMachine.SetInRangeToShootAnim(false);
     if (Vector3.Distance(stateMachine.transform.position, GameManager.Instance.player.transform.position) <= stateMachine.enemy.stats.ShootingRange)
     {
         stateMachine.enemy.conditions.isShootingRange = true;
         stateMachine.enemy.conditions.isIdle          = false;
     }
 }
예제 #3
0
 private void DoShooting(PlantStateMachine stateMachine)
 {
     stateMachine.ShootingMonobehaviour();
     if (Vector3.Distance(stateMachine.transform.position, GameManager.Instance.player.transform.position) > stateMachine.enemy.stats.ShootingRange)
     {
         stateMachine.enemy.conditions.isShootingRange = false;
         stateMachine.enemy.conditions.isIdle          = true;
         stateMachine.enemy.conditions.canShoot        = false;
         stateMachine.StopCoroutine("CounterToIsShootOn");
     }
 }
예제 #4
0
        private void DoDeathState(PlantStateMachine stateMachine)
        {
            stateMachine.enemy.hpIndicator.UpdateHp();
            stateMachine.navAgent.velocity = Vector3.zero;
            stateMachine.enemy.SetNewDamageIndicator();
            stateMachine.enemy.ParticleDamaged();
            stateMachine.SetTriggerDieAnim();
            stateMachine.SetIsDieAnim(true);

            stateMachine.enemy.conditions.Reset();
        }
예제 #5
0
 public IState DoState(PlantStateMachine stateMachine)
 {
     DoGetHit(stateMachine);
     if (stateMachine.enemy.conditions.isIdle)
     {
         return(stateMachine.idleState);
     }
     else if (stateMachine.enemy.conditions.isDead)
     {
         return(stateMachine.deathState);
     }
     else //if (stateMachine.enemy.conditions.isShootingRange)
     {
         return(stateMachine.shootRangeState);
     }
 }
예제 #6
0
        private void DoGetHit(PlantStateMachine stateMachine)
        {
            if (!GameManager.Instance.soundManager.isPlaying("PlantGetHit"))
            {
                GameManager.Instance.soundManager.Play("PlantGetHit");
            }
            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.isHitten = false;
        }
예제 #7
0
 public IState DoState(PlantStateMachine stateMachine)
 {
     DoIdle(stateMachine);
     if (stateMachine.enemy.conditions.isShootingRange)
     {
         return(stateMachine.shootRangeState);
     }
     else if (stateMachine.enemy.conditions.isHitten)
     {
         return(stateMachine.getHitState);
     }
     else if (stateMachine.enemy.conditions.isDead)
     {
         return(stateMachine.deathState);
     }
     else
     {
         return(this);
     }
 }