private void TimerEvents_Tick(object sender, EventArgs e)
 {
     if (_eventCollapse)
     {
         PanelEvent.Height += 10;
         if (PanelEvent.Size == PanelEvent.MaximumSize)
         {
             TimerEvents.Stop();
             _eventCollapse = false;
         }
     }
     else
     {
         PanelEvent.Height -= 10;
         if (PanelEvent.Size == PanelEvent.MinimumSize)
         {
             TimerEvents.Stop();
             _eventCollapse = true;
         }
     }
 }
 private void BtnEventMain_Click(object sender, EventArgs e)
 {
     TimerEvents.Start();
 }
示例#3
0
    private void checkForCompletion()
    {
        if (restart || gameOver)
        {
            return;
        }

        switch (SceneManager.GetActiveScene().name)
        {
        case "Level1":
            // The answer is 1 Ca / 1 C
            int rightItems = 0;
            foreach (KeyValuePair <string, int> entry in repo)
            {
                if (entry.Key == "Carbon" && entry.Value == 1)
                {
                    rightItems++;
                }
                if (entry.Key == "Calcium" && entry.Value == 1)
                {
                    rightItems++;
                }
            }
            if (rightItems == 2)
            {
                hasWon           = true;
                successText.text = "That's right! Press space to play the next level or Q to quit";
                TimerEvents timer = FindObjectOfType <TimerEvents>();
                timer.Stop();
            }
            break;

        case "Level2":
            // The answer is 1 Zn / 2 Cl
            int rightItems2 = 0;
            foreach (KeyValuePair <string, int> entry in repo)
            {
                if (entry.Key == "Zinc" && entry.Value == 1)
                {
                    rightItems2++;
                }
                if (entry.Key == "Chlorine" && entry.Value == 2)
                {
                    rightItems2++;
                }
            }
            if (rightItems2 == 2)
            {
                hasWon           = true;
                successText.text = "Great! Press space to play the next level or Q to quit";
                TimerEvents timer = FindObjectOfType <TimerEvents>();
                timer.Stop();
            }
            break;

        case "Level3":
            // The answer is 1 C / 10 O2
            int rightItems3 = 0;
            foreach (KeyValuePair <string, int> entry in repo)
            {
                if (entry.Key == "Oxygen" && entry.Value == 10)
                {
                    rightItems3++;
                }
                if (entry.Key == "Carbon" && entry.Value == 1)
                {
                    rightItems3++;
                }
            }
            if (rightItems3 == 2)
            {
                hasWon           = true;
                successText.text = "You won! Press Q to quit";
                TimerEvents timer = FindObjectOfType <TimerEvents>();
                timer.Stop();
            }
            break;

        default:
            break;
        }
    }