예제 #1
0
        public bool SameGenes(GenePool genes)
        {
            bool same = false;

            if (this.genes.GetAllGenes().Count == genes.GetAllGenes().Count)
            {
                same = true;
                for (int i = 0; i < this.genes.GetAllGenes().Count; i++)
                {
                    if (this.genes.GetAllGenes()[i] != genes.GetAllGenes()[i])
                    {
                        same = false;
                    }
                }
            }
            return(same);
        }
예제 #2
0
 private void Update()
 {
     if (genes.GetAllGenes().Count > 0)
     {
         if (delta > genes.GrowthTime())
         {
             delta = 0;
             if (watered)
             {
                 GrowingUp();
             }
         }
         AddTime(Time.deltaTime);
     }
 }
예제 #3
0
 private void Update()
 {
     if (genes.GetAllGenes().Count > 0)
     {
         if (delta > genes.GrowthTime())
         {
             delta = 0;
             if (watered && weeded)
             {
                 GrowingUp();
             }
         }
         delta += Time.deltaTime;
     }
 }
예제 #4
0
        public bool PlantPlant(GenePool seedling, int box)
        {
            bool canPlant = false;

            if (plants[box] == null && (box == 1 || box == 0))
            {
                canPlant    = true;
                plants[box] = Instantiate(plantPrefab, planterBoxes[box].transform).GetComponent <Plant>();
                foreach (Gene entity in seedling.GetAllGenes())
                {
                    plants[box].GetGenes().ModifyGenes(entity, plants[box].GetMainRender(), plants[box].GetSubRender());
                }
                plants[box].PlantGrewUp(RandomGrowthSpread);
            }
            return(canPlant);
        }