示例#1
0
 public void EndGame(bool won)
 {
     Debug.Log("Ending game with won = " + won.ToString());
     if (won)
     {
         CarnivalScores.Instance.IncrementShroomScore(pointsRewarded);
         ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, transform.position,
                                         transform.rotation);
         sh.SetPoints(pointsRewarded);
         yay.Play();
         Debug.Log("Won Game");
     }
     else
     {
         fail.Play();
         Debug.Log("Lost Game");
     }
     roundNumber  = 0;
     isGameActive = false;
     foreach (GameObject shroom in arrayOfShrooms)
     {
         shroom.SetActive(false);
     }
     startMenu.SetActive(true);
 }
    private void OnCoinLanded()
    {
        if (CarnivalManager.Instance.IsPlaying() && !CarnivalManager.Instance.IsCoinWon())
        {
            CarnivalManager.Instance.IncrementCoinScore(500);
            ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, transform.position,
                                            Quaternion.LookRotation(-transform.right));
            sh.SetPoints(500);

            hit.Play();
            // If user win the coins game, play the yay sound
            if (CarnivalManager.Instance.IsCoinWon())
            {
                yay.Play();
            }
        }

        /*
         #if UNITY_EDITOR
         * TMPro.TextMeshPro text = new GameObject().AddComponent<TMPro.TextMeshPro>();
         * text.transform.rotation = transform.rotation * Quaternion.Euler(0f, 270f, 0f);
         * text.transform.position = new Vector3(7.5f, 6f, -2f);
         * text.text = "OssDist0.7";
         #endif
         */
    }
示例#3
0
    private void OnCoinMissed()
    {
        ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, transform.position,
                                        Quaternion.LookRotation(-transform.right));

        sh.SetPoints(0);

        fail.Play();
    }
示例#4
0
    private void CarnivalNeedle_OnSpokeHit(float points)
    {
        isWheelSpinning = false;
        CarnivalScores.Instance.IncrementWheelScore(points);

        ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, WheelOfFortune.transform.position + WheelOfFortune.transform.forward.normalized * .5f,
                                        Quaternion.LookRotation(-WheelOfFortune.transform.forward));

        sh.SetPoints(points);
    }
示例#5
0
    //to be called from the Plinko Coin script
    public void CoinHitBottom(float points)
    {
        noActiveCoin = true;
        CarnivalScores.Instance.IncrementPlinkoScore(points);
        ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, PlinkoCoinOrigin.transform.position, Quaternion.LookRotation(-PlinkoCoinOrigin.transform.right));

        sh.SetPoints(points);

        Thud.Play();
    }
    private void OnCoinMissed()
    {
        if (CarnivalManager.Instance.IsPlaying() && !CarnivalManager.Instance.IsCoinWon())
        {
            ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, transform.position,
                                            Quaternion.LookRotation(-transform.right));
            sh.SetPoints(0);

            fail.Play();
        }
    }
示例#7
0
    private void OnCoinLanded()
    {
        CarnivalScores.Instance.IncrementCoinScore();
        ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, transform.position,
                                        Quaternion.LookRotation(-transform.right));

        sh.SetPoints(1000);

        yay.Play();

#if UNITY_EDITOR
        TMPro.TextMeshPro text = new GameObject().AddComponent <TMPro.TextMeshPro>();
        text.transform.rotation = transform.rotation * Quaternion.Euler(0f, 270f, 0f);
        text.transform.position = new Vector3(7.5f, 6f, -2f);
        text.text = "OssDist0.7";
#endif
    }
    //to be called from the Plinko Coin script
    public void CoinHitBottom(float points)
    {
        noActiveCoin = true;
        if (CarnivalManager.Instance.IsPlaying() && !CarnivalManager.Instance.IsPlinkoWon())
        {
            CarnivalManager.Instance.IncrementPlinkoScore(points);
            ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, PlinkoCoinOrigin.transform.position, Quaternion.LookRotation(-PlinkoCoinOrigin.transform.right));
            sh.SetPoints(points);

            Thud.Play();
            // If user win the pinko game, play the yay sound
            if (CarnivalManager.Instance.IsPlinkoWon())
            {
                yay.Play();
            }
        }
    }
    private void CarnivalNeedle_OnSpokeHit(float points)
    {
        if (CarnivalManager.Instance.IsPlaying() && !CarnivalManager.Instance.IsWheelWon())
        {
            CarnivalManager.Instance.IncrementWheelScore(points);

            ScoreHighlight sh = Instantiate(ScoreHighlighterPrefab, WheelOfFortune.transform.position + WheelOfFortune.transform.forward.normalized * .5f,
                                            Quaternion.LookRotation(-WheelOfFortune.transform.forward));
            sh.SetPoints(points);

            // If user win the wheel game, play the yay sound
            if (CarnivalManager.Instance.IsWheelWon())
            {
                yay.Play();
            }
        }

        isWheelSpinning = false;
    }