public override void applyOnAttack(StatsController stats) { var anim = stats.GetComponentInChildren <Animator>(); anim.runtimeAnimatorController = this.morph.GetComponentInChildren <Animator>().runtimeAnimatorController; stats.AddEffect("morphed", null, 20f, () => stats.ClearEffect("morphed")); stats.Damage(damage, name); }
/// <summary> /// If its armed and hits the target object then reduce that objects health and create an explosion /// </summary> /// <param name="other">The collider on the other side of the collision</param> void OnTriggerStay2D(Collider2D other) { if (armingTime <= 0 && (other.CompareTag(targetTag) || other.gameObject.layer == 8)) { //Create the explosion GameObject explosionInstance = Instantiate(explosionPrefab, transform.position + (transform.up * 0.1f), Quaternion.identity); explosionInstance.transform.SetParent(GameManager.instance.effectsPool); Destroy(explosionInstance, 0.267f); Destroy(gameObject); //Deal damage to the others objects stats StatsController stats = other.GetComponent <StatsController>(); stats.Damage(damage); } }
public new virtual void applyOnAttack(StatsController stats) { stats.Damage(damage, name); }