internal void WasDespawned() { CancelInvoke(); IsSpawned = false; Despawned?.Invoke(this); BroadcastMessage("OnDespawned", SendMessageOptions.DontRequireReceiver); }
private IEnumerator DieAsync() { Vector3 startScale = transform.localScale; const float duration = 1; for (float time = 0; time < 1; time += Time.deltaTime) { float t = time / duration; transform.localScale = Vector3.Lerp(startScale, Vector3.zero, t); yield return(null); } Destroy(gameObject); Despawned?.Invoke(); Destroy(gameObject); }
public void Despawn() { _despawnTimer?.Dispose(); Despawned?.Invoke(this, null); }
/// <summary> /// Despawn a tree into the pool /// </summary> /// <param name="obj"></param> public void Despawn(GameObject obj) { Despawned?.Invoke(); obj.SetActive(false); m_TreePool.Push(obj); }
public void Despawn() { gameObject.SetActive(false); Despawned?.Invoke(); }