Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        StartCoroutine(BlinkText());
        StartCoroutine(WaitText());
        RandomTitleGenerator.GetTitle();
        style = new GUIStyle();
        style.normal.textColor = Color.white;
        style.font             = font;

        if (Menu.Instance != null)
        {
            CurrentState = Menu.Instance.CurrentState;
        }
    }
Esempio n. 2
0
    IEnumerator StartGame()
    {
        ready     = true;
        startText = "3";
        yield return(new WaitForSeconds(0.75f));

        startText = "2";
        yield return(new WaitForSeconds(0.75f));

        startText = "1";
        yield return(new WaitForSeconds(0.75f));

        startText = "READY?";
        yield return(new WaitForSeconds(0.75f));

        startText = RandomTitleGenerator.GetReady();
        yield return(new WaitForSeconds(0.75f));

        GameManager.ActivePlayers = playersReady;
        CurrentState = GameState.Game;
        Application.LoadLevel("main2");
        yield return(null);
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        waitingPlayers = 0;
        for (int i = 0; i < playersReady.Length; i++)
        {
            if (playersReady[i])
            {
                waitingPlayers += 1;
            }
        }

        switch (CurrentState)
        {
        case GameState.Title:
            if (Input.GetKeyDown(KeyCode.Return))
            {
                title        = string.Empty;
                CurrentState = GameState.PlayerSelect;
            }

            if (Input.GetKeyDown(KeyCode.BackQuote))
            {
                title = RandomTitleGenerator.GetTitle();
            }

            break;

        case GameState.PlayerSelect:


            if (Input.GetKeyDown(KeyCode.X))
            {
                playersReady[0] = true;
            }
            if (Input.GetKeyDown(KeyCode.W))
            {
                playersReady[1] = true;
            }
            if (Input.GetKeyDown(KeyCode.O))
            {
                playersReady[2] = true;
            }
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                playersReady[3] = true;
            }

            if ((teamsReady()) && Input.GetKeyDown(KeyCode.Return))
            {
                StartCoroutine(StartGame());
            }
            break;

        case GameState.Game:
            break;

        case GameState.GameResults:
            if (Input.GetKeyDown(KeyCode.Return))
            {
                CurrentState = GameState.Title;
                Application.LoadLevel("menu");
            }
            break;
        }
    }