void OnHit(Thing thing) { thing.TakeDamage(damage, owner); if (gainBuff != null) { thing.AddBuff(Instantiate(gainBuff)); } Destroy(gameObject); }
void Do() { Collider2D[] cols = Physics2D.OverlapCircleAll(transform.position, radius, layerMask); foreach (Collider2D col in cols) { Thing thing = col.GetComponent <Thing>(); if (thing != null && thing.team != owner.team) { thing.TakeDamage(damage, owner); if (buff != null) { thing.AddBuff(Instantiate(buff)); } } } Destroy(gameObject); }
void Scan() { Collider2D[] cols = Physics2D.OverlapCircleAll(owner.transform.position, owner.col.radius * 4f, Utility.Instance.thingLayer); foreach (Collider2D col in cols) { Thing thing = col.GetComponent <Thing>(); if (thing != null && thing.team != owner.team && !hitList.Contains(thing)) { thing.TakeDamage(damage, owner); if (gainBuff != null) { thing.AddBuff(Instantiate(gainBuff)); } hitList.Add(thing); } } }