Example #1
0
        private static SgtTerrainObject Despawn(SgtTerrainObject prefab)
        {
            if (prefab.Pool == true)
            {
                SgtComponentPool <SgtTerrainObject> .Add(prefab);
            }
            else
            {
                prefab.Despawn();
            }

            return(null);
        }
Example #2
0
        private static SgtTerrainObject Spawn(SgtTerrainObject prefab)
        {
            if (prefab.Pool == true)
            {
                targetPrefab = prefab;

                var clone = SgtComponentPool <SgtTerrainObject> .Pop(ObjectMatch);

                if (clone != null)
                {
                    return(clone);
                }
            }

            return(Instantiate(prefab));
        }
Example #3
0
 private static bool ObjectMatch(SgtTerrainObject instance)
 {
     return(instance != null && instance.Prefab == targetPrefab);
 }