private void Despawn(SgtDebris debris) { debris.InvokeOnDespawn(); if (debris.Pool == true) { SgtComponentPool <SgtDebris> .Add(debris); } else { SgtHelper.Destroy(debris.gameObject); } }
private void Despawn(SgtDebris debris, int index) { debris.InvokeOnDespawn(); if (debris.Pool == true) { SgtComponentPool <SgtDebris> .Add(debris); } else { SgtHelper.Destroy(debris.gameObject); } this.debris.RemoveAt(index); }
private SgtDebris Spawn(SgtDebris prefab) { if (prefab.Pool == true) { targetPrefab = prefab; var debris = SgtComponentPool <SgtDebris> .Pop(DebrisMatch); if (debris != null) { debris.transform.SetParent(null, false); return(debris); } } return(Instantiate(prefab)); }
private SgtDebris Spawn(SgtDebris prefab) { if (prefab.Pool == true) { targetPrefab = prefab; var debris = SgtComponentPool <SgtDebris> .Pop(DebrisMatch); if (debris != null) { debris.transform.SetParent(null, false); return(debris); } } var clone = Instantiate(prefab); clone.gameObject.SetActive(true); return(clone); }
private bool DebrisMatch(SgtDebris debris) { return(debris != null && debris.Prefab == targetPrefab); }
private void Despawn(SgtDebris debris, int index) { Despawn(debris); spawnedDebris.RemoveAt(index); }