private void OnTriggerStay(Collider other) { IHasHealth otherHealth = other.GetComponent <IHasHealth>(); if (otherHealth != null && other.tag != gameObject.tag) { otherHealth.TakeDamage(dmgAmount); //print($"{this.name} hits {other.name} and causes damage"); } }
private void OnTriggerEnter(Collider other) { IHasHealth otherHealth = other.GetComponent <IHasHealth>(); //! will this cause a bug? I dont think so but if something doesnt collide check here if the GO Tags are not set up correctly. if (otherHealth != null && other.tag != gameObject.tag) { otherHealth.TakeDamage(dmgAmount); } }
private void OnTriggerEnter(Collider other) { IHasHealth otherHealth = other.GetComponent <IHasHealth>(); if (otherHealth != null && other.tag != gameObject.tag) { otherHealth.TakeDamage(dmgAmount); //print($"{this.name} hits {other.name} and causes damage"); Destroy(gameObject); } else { //print($"No damage from {this.name} hits {other.name}"); } }
public override void Update() { duration -= Time.deltaTime; if (duration <= 0) { OnFinish(); } else { currentTick -= Time.deltaTime; if (currentTick <= 0) { currentTick = (Config as PoisonConfig).DotTickSpeed; characterHealth.TakeDamage(null, 0, 0, (Config as PoisonConfig).DotTickDamage); } } }
private void OnTriggerEnter(Collider other) { IHasHealth otherHealth = other.GetComponent <IHasHealth>(); if (otherHealth != null && other.tag != gameObject.tag) { otherHealth.TakeDamage(dmgAmount); //! use this if we dont have durability Destroy(gameObject); //Destroy(gameObject); durability--; if (durability <= 0) { Destroy(gameObject); } } }