コード例 #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
ファイル: Plant.cs プロジェクト: sleepy-birdie/Planty-Game
 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);
        }