Beispiel #1
0
 public void OnTriggerEnter2D(Collider2D other)
 {
     if (canAttack && other.transform.tag == "monster")
     {
         monsterAI script = (monsterAI)other.transform.GetComponent(typeof(monsterAI));
         script.TakeDamage(damage);
         canAttack = false;
     }
 }
Beispiel #2
0
 protected override void Awake()
 {
     base.Awake();
     unitLevel            = 10;
     monster              = GetComponent <monsterAI>();
     maxHealth            = (baseHealth + 10 * unitLevel) * (1 + increasedHealth);
     currentHealth        = maxHealth;
     increasedAttackSpeed = 0;
 }
Beispiel #3
0
 public void OnTriggerEnter2D(Collider2D other)
 {
     if (other.transform.tag == "monster")
     {
         monsterAI script = (monsterAI)other.transform.GetComponent(typeof(monsterAI));
         script.TakeDamage(damage);
         myGameObject.SetActive(false);
     }
     else if (other.transform.tag == "obstacle")
     {
         myGameObject.SetActive(false);
     }
 }
Beispiel #4
0
 private void Awake()
 {
     m_Character = GetComponent <PlatformerCharacter2D>();
     monster     = GetComponent <monsterAI> ();
 }