void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "enemyBullet") { healthTracker ht = GetComponentInParent <healthTracker> (); ht.damagePlayer(ht.maxHealth / 10); other.gameObject.GetComponent <enemyBullet> ().playHitSound(); } }
// Use this for initialization private void OnEnable() { nextHex = null; healthOrb = GetComponent <healthTracker>(); //healthOrb.SetHealth(1); effectList = new List <MobEffect>(); clumpMobs = new List <mobBase>(); collider = GetComponent <CapsuleCollider>(); agent = GetComponent <NavMeshAgent>(); agent.enabled = false; destinationSet = false; }
private void OnEnable() { building = Building.no; modelObject = this.GetComponentInChildren <MeshRenderer>().gameObject; StartBuilding(); keepLinks = new List <GameObject>(); links = new Dictionary <GameObject, LinkType>(); autoLink = true; healthBar = GetComponent <healthTracker>(); buildingProperties = new List <BuildingProperties>(); linksMax = 1; updateLinks = true; updateDelay = 10; }