コード例 #1
0
    // Use this for initialization
    void Start()
    {
        foreach (GameObject egg in puffinEggs)
        {
            puffinEgg currentEgg = egg.GetComponent <puffinEgg>();
            Eggs.Add(currentEgg);
        }

        print(Eggs.Count);
        currentHatchIndex   = 0;
        currentHatchGoal    = LevelConstraints.instance.hatchGoals[currentHatchIndex];
        activeEgg           = Eggs [0];
        activeEgg.activeEgg = true;
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (activeEgg.hatched)
     {
         if (currentHatchIndex < LevelConstraints.instance.hatchGoals.Length - 1)
         {
             currentHatchIndex++;
             currentHatchGoal = LevelConstraints.instance.hatchGoals [currentHatchIndex];
         }
         activeEgg.circle.enabled = false;
         if (activeEggIndex < Eggs.Count - 1)
         {
             activeEggIndex++;
             GameManager.instance.scoreText.text = (activeEggIndex + " Pufflets fed! hooray!");
             activeEgg           = Eggs [activeEggIndex];
             activeEgg.activeEgg = true;
         }
         else
         {
             GameManager.instance.scoreText.text = ("All Pufflets fed! hooray!");
         }
     }
 }