public SceneObject GetSceneObject(SceneObjectData.types type) { foreach (SceneObject so in sceneObjects_pooled) { if (so.data.type == type) { so.gameObject.SetActive(true); sceneObjects_pooled.Remove(so); return(so); } } return(null); }
SceneObject CreateNew(SceneObjectData.types type) { SceneObject so_to_instantiate = obstacle1; switch (type) { case SceneObjectData.types.CHARACTER: so_to_instantiate = enemy; break; case SceneObjectData.types.OBSTACLE1: so_to_instantiate = obstacle1; break; case SceneObjectData.types.OBSTACLE2: so_to_instantiate = obstacle2; break; case SceneObjectData.types.GRAB: so_to_instantiate = grab1; break; } return(Instantiate(so_to_instantiate)); }