예제 #1
0
 private void CheckElement(int protonCount)
 {
     if (protonCount == targetProtonCount)
     {
         timer += 4;
         //positive feedback
         table.ShowAtomicNumber(protonCount);
         glowFX.BeginAnimation(true, UIColors.yellow, 4.0f, SetSymbolFromAvailable);
         //remove current
         availableElements.RemoveAt(targetIndex);
         //add the next 2 higheset
         if (maxUnlocked < 118)
         {
             availableElements.Add(++maxUnlocked);
             availableElements.Add(++maxUnlocked);
         }
         //add to completed
         completedElements.Add(protonCount);
         completedText.text = completedElements.Count.ToString();
         //check for win and bonus win
         if (completedElements.Count == 20)
         {
             tutorialUI.ShowWinMessage();
             CompleteGame();
             tutorialUI.ShowContinueButton(true);
         }
         else if (completedElements.Count == 118)
         {
             StopCoroutine("Coutdown"); //stop the coutdown
             ResetGame();
             tutorialUI.ShowBonusMessage();
             tutorialUI.ShowContinueButton(false);
         }
     }
     else
     {
         timer -= 1;
         glowFX.BeginAnimation(false, UIColors.orange, 4.0f, SetSymbolFromAvailable);
     }
 }
예제 #2
0
파일: MatchGame.cs 프로젝트: SavvyEdu/Atom
    private void Update()
    {
        //check for each of the 3 particle counts
        bool pMatch = atom.Nucleus.ProtonCount == targetProtons;
        bool nMatch = atom.Nucleus.NeutronCount == targetNeutrons;
        bool eMatch = atom.ElectronCount == targetElectrons;

        //adjust the colors the be blue when matched
        atomSymbol.SetUIColors(
            c: UIColors.blue,
            name: pMatch,
            abb: pMatch,
            number: pMatch,
            mass: pMatch && nMatch,
            charge: eMatch);

        //check for all matching
        if (!glowFX.IsAnimating && pMatch && nMatch && eMatch)
        {
            starImages[numCompleted].color = Color.yellow;
            numCompleted++;
            if (numCompleted == stars.transform.childCount)
            {
                StopCoroutine("Coutdown"); //stop the coutdown

                ResetGame();

                //display the win message
                if (challenge)
                {
                    tutorialUI.ShowBonusMessage();
                }
                else
                {
                    tutorialUI.ShowWinMessage();
                    CompleteGame();
                    challenge = true;
                }

                atom.Interactable = false;
            }
            //Visual glow then Make a new target after
            glowFX.BeginAnimation(true, UIColors.yellow, callback: SetRandomTarget);
        }
    }