/// <summary> /// checks if mainbody and health bar are not null, sets damagesource and foreground /// </summary> void Start() { if (MainBody != null) { DamageSource = MainBody.GetComponent <BreuDamageTake>(); } if (HealthBar != null) { Foreground = HealthBar.GetComponent <Image>(); } }
/// <summary> /// does damage to actors tagged "BreuPlayer" when colliders enter eachother /// </summary> void OnTriggerEnter(Collider col) { BreuDamageTake DT = col.GetComponent <BreuDamageTake>(); if (col.gameObject.tag == "BreuPlayer") { if (DT != null) { DT.TakeDamage(Damage);//damages object } } }
/// <summary> /// does damage to actors not tagged "BreuPlayer" when colliders enter eachother /// </summary> void OnTriggerEnter(Collider col) { BreuDamageTake DT = col.GetComponent <BreuDamageTake>(); if (col.gameObject.tag != "BreuPlayer") { if (DT != null) { DT.TakeDamage(Damage);//damages object } if (DisappearsOnHit == true) { Destroy(gameObject);//destorys bullet if it should disappear on hit } } }
void Start() { cam = Camera.main; Status = MainBody.GetComponent <BreuDamageTake>(); }
void Start() { Status = MainBody.GetComponent <BreuDamageTake>(); }