Beispiel #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;
        }
    }
Beispiel #2
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;
        }
    }