コード例 #1
0
ファイル: EnemyBehaviour.cs プロジェクト: parasboy/codeforuse
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Bullet"))
     {
         if (canAnimate)
         {
             gameManager.UpdatePlayerScore(1);
             enemyAnim.DeathAnimation();
             Instantiate(deathParticles, transform.position, Quaternion.identity);
             Instantiate(SelectDecal(), transform.position, transform.rotation);
         }
         canChase   = false;
         canAnimate = false;
         StartCoroutine(Death());
     }
 }
コード例 #2
0
 public void ReceivedDamage(float DamageTaken)                           //Function to damage the enemy
 {
     HP -= DamageTaken;
     if (HP <= 0)
     {
         //call death animation
         enemyAnimation.DeathAnimation();
         gameObject.GetComponent <BoxCollider>().enabled = false;
         //disactivates enemies
         Destroy(Vision);
         Idle            = false;
         Patrol          = false;
         DetectedPlayer  = false;
         HuntingPlayer   = false;
         dead            = true;
         Agent.isStopped = true;
     }
     //call damage animation
     DetectedPlayer = true;
     enemyAnimation.DamageAnimation();
 }