Beispiel #1
0
 public virtual void CreateDaughter()
 {
     if (FoodAmount >= maxFood)
     {
         FoodAmount = -maxFood;
         daughters++;
         NewGameController.Instance.TeamSize[teamID] += 1;
         if (DaughterPool.Count > 0)
         {
             DaughterController recycle = DaughterPool.Find(f => !f.isActive);
             if (recycle != null)
             {
                 recycle.SetMoM(this.gameObject);
                 recycle.transform.position = Location + new Vector3(1, 0, 1);
             }
             else
             {
                 InstantiateDaughter();
             }
         }
         else
         {
             InstantiateDaughter();
         }
         maxFood += 10;
     }
 }
Beispiel #2
0
    protected void InstantiateDaughter()
    {
        GameObject         spawn = Instantiate(daughterFab, SpawnMouth, FaceForward) as GameObject;
        DaughterController dc    = spawn.GetComponent <DaughterController>();

        NetworkServer.Spawn(spawn);
        dc.SetMoM(this.gameObject);
        DaughterPool.Add(dc);
    }