Exemple #1
0
 /*
  * NewPhase: se encarga de cambiar la fase del agente.
  */
 public void NewPhase()
 {
     if (agent != null)
     {
         GameObject obj      = Instantiate(agent, new Vector2(this.transform.position.x, this.transform.position.y), this.transform.rotation);
         BaseAgent  objAgent = obj.GetComponent <BaseAgent>();
         if (baseAgent != null)
         {
             objAgent.Init(dna, perfectDna, worstDna, baseAgent.hunger);
             if (isTarget)
             {
                 obj.GetComponent <Clickeable>().Evolve();
             }
             baseAgent.DeadAction();
         }
         else
         {
             objAgent.Init(dna, perfectDna, worstDna, 1);
             if (isTarget)
             {
                 obj.GetComponent <Clickeable>().Evolve();
             }
             Destroy(gameObject);
         }
         obj.GetComponent <LifeCycle>().InitCycle(dna, timeOfLife, worstDna, perfectDna);
     }
 }