Example #1
0
 private void KillDynamicObject(RaycastHit hit, ref float killDelay)
 {
     if (hit.collider.tag == "Enemy")
     {
         Animator        animatorEnemy = hit.collider.gameObject.GetComponent <Animator>();
         GameObject      go            = hit.collider.gameObject;
         EnemyController other         = (EnemyController)go.GetComponent(typeof(EnemyController));
         other.enabled = false;
         //other.SetDelay();
         animatorEnemy.speed = 1.5f;
         animatorEnemy.SetTrigger("IsDead");
         killDelay = 2;
     }
     if (hit.collider.tag == "Player")
     {
         PlayerController.SetDead();
         Animator animatorPlayer = hit.collider.gameObject.GetComponent <Animator>();
         animatorPlayer.SetTrigger("IsDead");
         killDelay = 2;
     }
     hit.collider.enabled = false;
 }