Пример #1
0
    IEnumerator OnMouseDown()
    {
        MemoryMatchGameManager manager = MemoryMatchGameManager.GetInstance();

        if (manager.inputAllowed && !isGuessing && (manager.isGameStarted() || manager.isRunningTutorial()))
        {
            isGuessing = true;

            OpenLid();
            manager.subtitlePanel.Display(myFood.name, myFood.clipOfName);

            if (manager.GetFoodToMatch().name != myFood.name)
            {
                if (!matched && !manager.isRunningTutorial())
                {
                    manager.SubtractTime(3.0f);
                }
                yield return(new WaitForSeconds(2f));

                CloseLid();
            }
            else
            {
                Correct();
                yield return(new WaitForSeconds(1.5f));

                manager.ChooseFoodToMatch();
            }

            //The player can now guess again.
            manager.subtitlePanel.Hide();
            isGuessing = false;
        }
    }
Пример #2
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        if (!GameManager.GetInstance())
        {
            SwitchScene switchScene = this.gameObject.AddComponent <SwitchScene> ();
            switchScene.loadScene("Start");
        }
        else
        {
            difficultyLevel = GameManager.GetInstance().GetLevel("MemoryMatch");
            typeOfMonster   = GameManager.GetMonsterType();
            CreateMonster();
            monsterObject.PlaySpawn();
            RetrieveFoodsFromManager();

            if (GameManager.GetInstance().LagoonReview)
            {
                StartReview();
            }
            else
            {
                PregameSetup();
            }
        }
    }
Пример #3
0
 public void Correct()
 {
     SoundManager.GetInstance().PlayCorrectSFX();
     if (!lid.activeSelf)
     {
         lid.SetActive(true);
     }
     dishAnim.Play("Dish_Correct");
     MemoryMatchGameManager.GetInstance().AddToMatchedList(myFood);
     matched = true;
 }
    /**
     * \brief OnMouseDown is called when the player clicks (or taps) one of the dishes.
     *
     * Check if this dish's myFood matches the foodToMatch. If it does match, deactivate
     * the top part of the dish permenanatly, otherwise, cover the food again.
     * @return WaitForSeconds for a delay.
     */

    IEnumerator OnMouseDown()
    {
        MemoryMatchGameManager manager = MemoryMatchGameManager.Instance;

        if (manager.inputAllowed && !manager.isGuessing)
        {
            SubtitlePanel.Instance.Display(myFood.name);
            SoundManager.Instance.AddToVOQueue(myFood.clipOfName);
            OpenLid();
            if (!manager.OnGuess(this, myFood.gameObject))
            {
                Invoke("CloseLid", 2f);
            }

            yield return(new WaitForSeconds(2f));

            //The player can now guess again.
            SubtitlePanel.Instance.Hide();
            manager.isGuessing = false;
        }
    }
Пример #5
0
    /**
     * \brief OnMouseDown is called when the player clicks (or taps) one of the dishes.
     *
     * Check if this dish's myFood matches the foodToMatch. If it does match, deactivate
     * the top part of the dish permenanatly, otherwise, cover the food again.
     * @return WaitForSeconds for a delay.
     */
    IEnumerator OnMouseDown()
    {
        Animation animation = top.GetComponent <Animation>();

        if (!isGuessing && (MemoryMatchGameManager.GetInstance().isGameStarted() || MemoryMatchGameManager.GetInstance().isRunningTutorial()))
        {
            isGuessing = true;

            //Reveal the food underneath the dish by setting the sprite renderer to disabled.
            top.GetComponent <Animation>().Play(animation["DishTopRevealLift"].name);
            MemoryMatchGameManager.GetInstance().subtitlePanel.Display(myFood.name, myFood.clipOfName);

            if (MemoryMatchGameManager.GetInstance().GetFoodToMatch().name != myFood.name)
            {
                if (!matched)
                {
                    MemoryMatchGameManager.GetInstance().SubtractTime(3.0f);
                    yield return(new WaitForSeconds(2f));
                }

                top.GetComponent <Animation>().Play(animation["DishTopRevealClose"].name);
            }
            else
            {
                top.GetComponent <Animation>().Play(animation["DishTopRevealLift"].name);
                SoundManager.GetInstance().PlayCorrectSFX();
                MemoryMatchGameManager.GetInstance().AddToMatchedList(myFood);
                yield return(new WaitForSeconds(1.5f));

                top.GetComponent <SpriteRenderer>().enabled = false;
                matched = true;

                MemoryMatchGameManager.GetInstance().ChooseFoodToMatch();
            }
            //The player can now guess again.
            MemoryMatchGameManager.GetInstance().subtitlePanel.Hide();
            isGuessing = false;
        }
    }
    // Use this for initialization
    void Awake()
    {
        if(instance == null) {
            instance = this;
        }
        else if(instance != this) {
            Destroy(gameObject);
        }

        if(timer != null) {
            timer = Instantiate(timer);
            timer.SetTimeLimit(timeLimit);
        }

        UpdateScoreText();

        activeFoods = new List<GameObject>();
        difficultyLevel = GameManager.GetInstance().GetLevel("MemoryMatch");
    }