void Awake()
 {
     // Set up the references.
     player       = GameObject.FindGameObjectWithTag("Player").transform;
     anim         = GetComponent <Animator>();
     playerHealth = player.GetComponent <ThiefHealth>();
     mechHealth   = GetComponent <MechHealth>();
     nav          = GetComponent <UnityEngine.AI.NavMeshAgent>();
 }
Exemplo n.º 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Enemy")
     {
         if (enemyType == "MechEnemy")
         {
             MechHealth enemyHeahth = other.gameObject.GetComponent <MechHealth>();
             enemyHeahth.TakeDamage(enemyHeahth.maxHP, transform.position + transform.forward * 0.3f);
         }
         else
         {
             if (enemyType == "FlightEnemy")
             {
                 NormalArmor enemyHeahth = other.gameObject.GetComponent <NormalArmor>();
                 enemyHeahth.TakeDamage(0.3f * enemyHeahth.fullArmor, transform.position + transform.forward * 0.3f);
             }
         }
     }
     StartCoroutine(DertroyBullet());
 }