public void DestroyObject(Vector3 force) { if (!m_completeObject.activeSelf) { return; } GetComponent <Collider>().enabled = false; m_completeObject.SetActive(false); m_destrucedObject.SetActive(true); GetComponent <NoiseSource>().Play(); var dTransform = m_destrucedObject.transform; for (int i = 0; i < dTransform.childCount; ++i) { var rb = dTransform.GetChild(i).GetComponent <Rigidbody>(); //rb.AddForce(force); rb.AddExplosionForce(100.0f, transform.position, 3.0f); } if (OnDestruction != null) { OnDestruction.Invoke(new DestructionEventData(this.gameObject)); } }
private void OnDestroy() { if (OnDestruction != null) { OnDestruction.Invoke(EntityDestructionContext.DESTROYED_BY_OTHER); } Destruct(); }
protected virtual void DestructionByDamage() { if (OnDestruction != null) { OnDestruction.Invoke(EntityDestructionContext.DESTROYED_BY_DAMAGE); } Destruct(); }
protected virtual void SelfDestruction() { if (OnDestruction != null) { OnDestruction.Invoke(EntityDestructionContext.SELF_DESTROYED); } Destruct(); }
private void Destroy() { StopAllCoroutines(); OnDestruction?.Invoke(gameObject); }
private void WarnsAdvice() { StopAllCoroutines(); OnDestruction?.Invoke(gameObject); }