public IBuff NewBuff(IBuff.BuffType type) { IBuff buff = null; if (mRecoveryBuffList[(int)type].Count > 0) { buff = mRecoveryBuffList[(int)type].Pop(); } else { if (type == IBuff.BuffType.Move) { buff = new MoveBuff(); } else if (type == IBuff.BuffType.Behavior) { buff = new BehaviorBuff(); } else if (type == IBuff.BuffType.Hurt) { buff = new HurtBuff(); } else if (type == IBuff.BuffType.Control) { buff = new ControlBuff(); } } buff.mInstId = ++mInstId; return(buff); }
void OnTriggerEnter(Collider other) { if (!other.gameObject.Equals(owner)) { // Destroy (other.gameObject); HurtBuff hurt = new HurtBuff(); hurt.execute(other.gameObject); Instantiate(effect, other.gameObject.transform.position, other.gameObject.transform.rotation); } }