Exemplo n.º 1
0
    public void ClickCup(GameObject obj)
    {
        if (!isPlaying)
        {
            return;
        }

        ChangeableItem ci = obj.GetComponent <ChangeableItem>();

        if (ci.isGood)
        {
            neededCups--;
            mdb.winTime(0.3f);
            GameSound.gameSound.PlaySFX("collect_X");
            obj.SetActive(false);

            if (neededCups == 0)
            {
                EndGame();
            }
        }
        else
        {
            GameSound.gameSound.PlaySFX("error");
            mdb.loseTime(1.0f);
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        mdb = this.gameObject.GetComponent <MiniGameDefaultBehavior>();

        EventManager.StartListening("MiniGameStarted", OnMiniGameStarted);


        for (int i = 0; i < CupList.Count; i++)
        {
            GameObject temp        = CupList[i];
            int        randomIndex = Random.Range(i, CupList.Count);
            CupList[i]           = CupList[randomIndex];
            CupList[randomIndex] = temp;
        }

        for (int a = 0; a < CupList.Count; a++)
        {
            ChangeableItem temp = CupList[a].GetComponent <ChangeableItem>();
            temp.SendMDB(mdb);
            if (a < numBadCups)
            {
                temp.setBadState();
            }
        }
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        mdb = this.gameObject.GetComponent <MiniGameDefaultBehavior>();

        groupInitX = mainGroup.transform.position.x;
        groupInitY = mainGroup.transform.position.y;

        for (int i = 0; i < CupList.Count; i++)
        {
            GameObject temp        = CupList[i];
            int        randomIndex = Random.Range(i, CupList.Count);
            CupList[i]           = CupList[randomIndex];
            CupList[randomIndex] = temp;
        }

        for (int a = 0; a < CupList.Count; a++)
        {
            ChangeableItem temp = CupList[a].GetComponent <ChangeableItem>();
            temp.SendMDB(mdb);
            if (a < numBadCups)
            {
                temp.setBadState();
            }
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        bool hasBadCup = false;

        for (int i = 0; i < CupList.Count; i++)
        {
            ChangeableItem temp = CupList[i].GetComponent <ChangeableItem>();
            if (!temp.isGood)
            {
                hasBadCup = true;
            }
        }

        if (!hasBadCup)
        {
            isPlaying = false;

            if (activePage < gamePages)
            {
                activePage++;
                LoadNextPage();
            }
            else
            {
                EndGame();
            }

            return;
        }

        if (!mdb.hasTimeLeft() && hasBadCup)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
    }
Exemplo n.º 5
0
    void SetupPage()
    {
        for (int i = 0; i < CupList.Count; i++)
        {
            GameObject temp        = CupList[i];
            int        randomIndex = Random.Range(i, CupList.Count);
            CupList[i]           = CupList[randomIndex];
            CupList[randomIndex] = temp;
        }

        for (int a = 0; a < CupList.Count; a++)
        {
            ChangeableItem temp = CupList[a].GetComponent <ChangeableItem>();
            temp.ResetItem();
            if (a < numBadCups)
            {
                temp.setBadState();
            }
        }

        ShowNextPage();
    }