예제 #1
0
 public void OnDamage(DamageInfo damage)
 {
     life -= damage.calcAbsoluteDmg(dmgfactor);
     if (healthbar)
     {
         healthbar.SetHealthVisual(life / maxlife);
     }
     if (life <= 0)
     {
         Destroy(this.gameObject);
     }
 }
예제 #2
0
파일: BaseEnemy.cs 프로젝트: kofl91/TD-KI
 // Initialisierung
 void Start()
 {
     life        = maxlife;
     agent       = GetComponent <NavMeshAgent>();
     agent.speed = speed;
     if (target)
     {
         agent.SetDestination(target.transform.position);
     }
     healthbar = GetComponentInChildren <Healthbar>();
     if (healthbar)
     {
         healthbar.SetHealthVisual(life / maxlife);
     }
 }
예제 #3
0
파일: BaseEnemy.cs 프로젝트: kofl91/TD-KI
 // Funktion wird bei jedem Treffer ausgeführt
 public void OnDamage(DamageInfo damage)
 {
     life -= damage.calcAbsoluteDmg(resistance);
     if (healthbar)
     {
         healthbar.SetHealthVisual(life / maxlife);
     }
     if (life <= 0)
     {
         if (!gaveBounty)
         {
             if (enemy)
             {
                 enemy.Gold += bounty;
                 gaveBounty  = true;
             }
         }
         Destroy(this.gameObject);
     }
 }