Ejemplo n.º 1
0
 private void Pool()
 {
     AgentController.CacheAgent(this);
     if (CachedGameObject != null)
     {
         CachedGameObject.SetActive(false);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Completes the life of the agent and pools or destroys it.
 /// </summary>
 /// <param name="agent">Agent.</param>
 public static void CompleteLife(LSAgent agent)
 {
     if (agent.CachedGameObject != null)
     {
         agent.CachedGameObject.SetActive(false);
     }
     if (agent.TypeIndex != UNREGISTERED_TYPE_INDEX)
     {
         AgentController.CacheAgent(agent);
     }
     else
     {
         //This agent was not registered for pooling. Let's destroy it
         GameObject.Destroy(agent);
     }
 }