Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (timeLeft > 0f)
        {
            timeLeft -= Time.deltaTime;

            if (timeLeft >= 10)
            {
                timer.text = "00:" + ((int)timeLeft);
            }
            else
            {
                timer.text = "00:0" + ((int)timeLeft);
            }
        }
        else
        {
            if (!donezo)
            {
                // Time.timeScale = 0;
                MinigameManager.FinishMinigame(true);

                donezo = true;
            }
        }
    }
Пример #2
0
 public void KillBaddie()
 {
     currentBaddies--;
     if (currentBaddies == 0)
     {
         MinigameManager.FinishMinigame(true);
     }
 }
Пример #3
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Border" || collision.gameObject.tag == "Player")
     {
         Destroy(this.gameObject);
         MinigameManager.FinishMinigame(false);
     }
 }
Пример #4
0
        private void LoseState()
        {
            if (!minigameOver)
            {
                wire_Count = -1;

                //uiText.GetComponent<Text>().text = "Oof. Maybe next time";
                remaining    = new int[] { 0, 1, 2 };
                minigameOver = true;
                MinigameManager.FinishMinigame(false);
            }
        }
Пример #5
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         //win state
         MinigameManager.FinishMinigame(true);
     }
     if (Input.GetKeyDown(KeyCode.LeftShift))
     {
         //lose state
         MinigameManager.FinishMinigame(false);
     }
     if (Input.GetKeyDown(KeyCode.LeftControl))
     {
         //draw state
         MinigameManager.FinishMinigame();
     }
 }
Пример #6
0
 public void EndGame(string endCondition)
 {
     if (endCondition == "lose")
     {
         /*Canvas.SetActive(true);
          * Panel_Lose.SetActive(true);
          * Panel_Win.SetActive(false);*/
         MinigameManager.FinishMinigame(false);
     }
     else if (endCondition == "win")
     {
         /*Canvas.SetActive(true);
          * Panel_Lose.SetActive(false);
          * Panel_Win.SetActive(true);*/
         MinigameManager.FinishMinigame(true);
     }
     player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
     enemy.GetComponent <Rigidbody2D>().velocity  = new Vector2(0, 0);
 }
Пример #7
0
        private void WinState()
        {
            if (!minigameOver)
            {
                //uiText.GetComponent<Text>().text = "Nice!";
                print("You won");

                unlock.clip = unlockLock;
                unlock.Play();
                wire_Count = -1;

                remaining    = new int[] { 0, 1, 2 };
                minigameOver = true;
                MinigameManager.FinishMinigame(true);

                /*
                 * Probably will add more things.
                 * Lock Background image should be changed as popped open instead of still closed
                 * audio plays of a very satisfying, audible "pop"
                 */
            }
        }
Пример #8
0
    IEnumerator endGame()
    {
        if (loseState == 1)
        {
            anim.enabled = false;

            Fatality.gameObject.SetActive(true);
            yield return(new WaitForSeconds(3f));

            MinigameManager.FinishMinigame(false);
        }
        else if (winState == 1)
        {
            //win state
            enemyAnim.enabled = false;

            Fatality.gameObject.SetActive(true);
            yield return(new WaitForSeconds(3f));

            MinigameManager.FinishMinigame(true);
        }
    }
Пример #9
0
 private void Lose()
 {
     MinigameManager.FinishMinigame(false);
 }
Пример #10
0
 private void Win()
 {
     MinigameManager.FinishMinigame(true);
 }
Пример #11
0
        IEnumerator GameLoop(ushort loops)
        {
            slider.gameObject.SetActive(memorizeText.enabled = repeatText.enabled = false);
            AudioManager.instance.PlayMusic(music, 1f, speed, true);
            yield return(new WaitForSeconds(initialWaitTime));

            for (ushort h = 0; h < loops; h++)
            {
                c = 0;
                slider.maxValue      = maxTime;
                slider.value         = slider.minValue;
                memorizeText.enabled = true;

                // generate new set of buttons and placeholders
                int size = Mathf.RoundToInt(Random.value * deltaButtons) + minButtons;
                buttons       = new GameObject[size];
                buttonSprites = new SpriteRenderer[size];
                keys          = new ControlStick[size];

                float j = -buttons.Length - 1;
                for (ushort i = 0; i < buttons.Length; i++)
                {
                    j               += 2;
                    buttons[i]       = Instantiate(buttonPrefab, new Vector3(j, 0f, 0f), Quaternion.Euler(0f, 0f, RandomDirection(i)));
                    buttonSprites[i] = buttons[i].GetComponent <SpriteRenderer>();
                }

                slider.gameObject.SetActive(true);
                // memorize
                while (slider.value < slider.maxValue)
                {
                    slider.value += Time.deltaTime;
                    yield return(null);
                }
                slider.gameObject.SetActive(false);
                memorizeText.enabled = false;

                // hide buttons
                foreach (GameObject button in buttons)
                {
                    button.SetActive(false);
                }

                slider.value       = slider.maxValue = absoluteMaxTime;
                repeatText.enabled = true;
                slider.gameObject.SetActive(true);
                // repeat
                isInputAllowed = true;
                while (slider.value > slider.minValue)
                {
                    slider.value -= Time.deltaTime;
                    yield return(null); // yields for Update()
                }
                isInputAllowed = false;
                slider.gameObject.SetActive(false);
                repeatText.enabled = false;
                if (c < buttons.Length)
                {
                    isWin = false;
                }

                // compare results
                foreach (GameObject button in buttons)
                {
                    button.SetActive(true);
                }
                yield return(new WaitForSeconds(waitTime));

                // clean up
                foreach (GameObject button in buttons)
                {
                    Destroy(button);
                }

                if (!isWin)
                {
                    AudioManager.instance.StopMusic();
                    MinigameManager.FinishMinigame(isWin);
                    yield break;
                }

                // up the ante
                minButtons++;
                yield return(null);
            }

            AudioManager.instance.StopMusic();
            MinigameManager.FinishMinigame(isWin);
        }
 public void PlayTest()
 {
     print("Play Button Pressed");
     MinigameManager.FinishMinigame();
 }