コード例 #1
0
 public IState DoState(GolemStateMachine stateMachine)
 {
     if (!stateMachine.GetIsDieAnim())
     {
         DoDeathState(stateMachine);
     }
     return(this);
 }
コード例 #2
0
 private void DoAttack(GolemStateMachine stateMachine)
 {
     stateMachine.navAgent.isStopped = true;
     stateMachine.navAgent.velocity  = Vector3.zero;
     //set anim and dmg stuff
     if (stateMachine.enemy.conditions.canMegaAttack)
     {
         stateMachine.SetTriggerMegaAttackAnim();
         stateMachine.LookPlayer();
         stateMachine.MegaAttackCD(Random.Range(5f, 10f));
     }
 }
コード例 #3
0
 private void DoDeathState(GolemStateMachine 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.enemy.conditions.Reset();
     stateMachine.enemy.conditions.isDead = true;
 }
コード例 #4
0
 public IState DoState(GolemStateMachine stateMachine)
 {
     DoAttack(stateMachine);
     if (!stateMachine.enemy.conditions.canMegaAttack)
     {
         stateMachine.WaitToPatrol();
         if (stateMachine.canPat)
         {
             return(stateMachine.patrolState);
         }
     }
     return(this);
 }
コード例 #5
0
 private void DoPatrol(GolemStateMachine stateMachine)
 {
     stateMachine.navAgent.isStopped = false;
     stateMachine.navAgent.SetDestination(stateMachine.patrolTarget.position);
     if (Vector3.Distance(GameManager.Instance.player.transform.position, stateMachine.transform.position) <= stateMachine.enemy.stats.ShootingRange)
     {
         stateMachine.enemy.conditions.isShootingRange = true;
         stateMachine.enemy.conditions.isPatrol        = false;
     }
     else
     {
         stateMachine.enemy.conditions.isShootingRange = false;
     }
     stateMachine.enemy.conditions.isPatrol = true;
 }
コード例 #6
0
 public IState DoState(GolemStateMachine stateMachine)
 {
     DoGetHit(stateMachine);
     if (stateMachine.enemy.conditions.isAttackRange)
     {
         return(stateMachine.attackState);
     }
     else if (stateMachine.enemy.conditions.isDead)
     {
         return(stateMachine.deathState);
     }
     else
     {
         return(stateMachine.patrolState);
     }
 }
コード例 #7
0
        private void DoGetHit(GolemStateMachine stateMachine)
        {
            if (!GameManager.Instance.soundManager.isPlaying("GolemGetHit"))
            {
                GameManager.Instance.soundManager.Play("GolemGetHit");
            }
            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;
        }
コード例 #8
0
 public IState DoState(GolemStateMachine stateMachine)
 {
     DoPatrol(stateMachine);
     if (stateMachine.enemy.conditions.isHitten)
     {
         return(stateMachine.getHitState);
     }
     else if (stateMachine.enemy.conditions.isDead)
     {
         return(stateMachine.deathState);
     }
     else if (stateMachine.enemy.conditions.isShootingRange && stateMachine.enemy.conditions.canMegaAttack)
     {
         return(stateMachine.attackState);
     }
     else
     {
         return(stateMachine.patrolState);
     }
 }