public void SetAttackWhenDestory(float scale, AttackInfo attackInfo, HashSet <GameObject> hitSet) { if (scale <= 0f) { throw new System.ArgumentOutOfRangeException(nameof(scale), "Must be greater than 0."); } _ = attackInfo ?? throw new System.ArgumentNullException(nameof(attackInfo)); destoryMethod += DeathAttack(scale, attackInfo, hitSet); }
//오브젝트에 설정된 모든 동작들을 중지 또는 삭제 한다. AttackObject의 경우 충돌 이벤트도 포함된다. // 주의 : 동작에 의해 이미 일어난 변화를 초기화 시키지 않음 public virtual void StopActions() { updateMethod = null; fixedUpdateMethod = null; destoryMethod = null; StopAllCoroutines(); if (rigid != null) { rigid.velocity = Vector3.zero; } }
//SetSignalWhenDestory : 이 오브젝트가 사라질 떄 SignalMethod method를 호출한다. //호출 시 매개변수는 이 오브젝트의 transform. //다른 Public Method로 오브젝트 내부에서 Destory 작업을 수행하도록 유도해야만 method 호출이 수행된다. public void SetSignalWhenDestory(SignalMethod method) { _ = method ?? throw new System.ArgumentNullException(nameof(method)); destoryMethod += method; }