コード例 #1
0
    void CheckTokenLocation()
    {
        // Do not start
        if ((p1rect.anchoredPosition.x == p2rect.anchoredPosition.x) && (p1rect.anchoredPosition.x != mx))
        {
            //Debug.Log("You must select different characters.");
            // tell players that they cannot choose the same character
            text.text = ogtext;
            if (transparent)
            {
                StartCoroutine(FadeTextToFullAlpha(0.7f, text));
            }
        }
        else if ((p1rect.anchoredPosition.x == rx && p2rect.anchoredPosition.x == lx) || (p1rect.anchoredPosition.x == lx && p2rect.anchoredPosition.x == rx))
        {
            //Change text to timer
            if (timer > 0.5)
            {
                // Starting countdown
                timer    -= Time.deltaTime;
                text.text = "Starting in " + (timer).ToString("0");
                if (transparent)
                {
                    StartCoroutine(FadeTextToFullAlpha(0.7f, text));
                }
            }
            else
            {
                text.text = "Starting meow!";

                // Set characters to controllers based on player one
                if (p1rect.anchoredPosition.x < 0)
                {
                    playerHandler.ChooseKnife();
                }
                else if (p1rect.anchoredPosition.x > 0)
                {
                    playerHandler.ChooseFridge();
                }
                // Start game
                faderAnimator.SetTrigger("FadeOut");
                Invoke("StartGame", 0.75f);
            }
        }
    }