Example #1
0
    public void Show(Transform s, SlimeHealth h)
    {
        buildHealth = h;
        arrow.PositionArrow(s);

        teamController.SetControlPanelDisplay(false);
        teamController.SetControlButtonDisplay(false);
        chattingPanel.SetChatButtonDisplay(false);
        chattingPanel.SetChatPanelDisplay(false);
        BuildingPanelDisplay(true);
    }
    IEnumerator DisplayGamePanel()
    {
        if (currentState == State.idle)
        {
            yield return(new WaitForSeconds(1f));

            gameDisplayText.text    = "<size=60><color=#ff0000ff>" + PhotonNetwork.playerName + "</color>\n" + "<color=#ffff00ff>vs</color>\n<color=#00ffffff>" + PhotonNetwork.otherPlayers[0].NickName + "</color></size>";
            gameDisplayText.enabled = true;
            yield return(new WaitForSeconds(3f));

            gameDisplayText.enabled = false;
            yield return(new WaitForSeconds(0.5f));

            /* sync the GameReady */
            if (PhotonNetwork.isMasterClient)
            {
                photonView.RPC("RPC_GameReady", PhotonTargets.All);
            }
        }
        else if (currentState == State.ready)
        {
            gameDisplayText.enabled = true;
            if (team_red_score == matchPoint || team_blue_score == matchPoint)
            {
                gameDisplayText.text = "<size=70><color=#ffff00ff>Match Point</color></size>";
                yield return(new WaitForSeconds(1.5f));
            }
            if (currentRound == totalRoundGame)
            {
                gameDisplayText.text = "<size=60>Final Round" + "\nReady!</size>";
            }
            else
            {
                gameDisplayText.text = "Round " + currentRound + "\nReady!";
            }
            yield return(new WaitForSeconds(1.5f));

            camManager.SetCameraMovement(true);
            gameDisplayText.text = "<size=100>3</size>";
            yield return(new WaitForSeconds(1f));

            gameDisplayText.text = "<size=100>2</size>";
            yield return(new WaitForSeconds(1f));

            gameDisplayText.text = "<size=100>1</size>";
            yield return(new WaitForSeconds(1f));

            gameDisplayText.enabled = false;

            yield return(new WaitForSeconds(0.5f));

            /* sync the building timer */
            if (PhotonNetwork.isMasterClient)
            {
                photonView.RPC("RPC_BuildStart", PhotonTargets.All);
            }
        }
        else if (currentState == State.build_start)
        {
            gameDisplayText.text    = "Building\nTime!";
            gameDisplayText.enabled = true;
            yield return(new WaitForSeconds(1f));

            gameDisplayText.enabled = false;
        }
        else if (currentState == State.build_end)
        {
            gameDisplayText.text    = "Stop\nBuilding!";
            gameDisplayText.enabled = true;
            yield return(new WaitForSeconds(1f));

            gameDisplayText.enabled = false;

            yield return(new WaitForSeconds(3f));

            /* sync the Battle Start */
            if (PhotonNetwork.isMasterClient)
            {
                photonView.RPC("RPC_BattleStart", PhotonTargets.All);
            }
        }
        else if (currentState == State.battle_start)
        {
            gameDisplayText.text    = "Battle Start!";
            gameDisplayText.enabled = true;
            yield return(new WaitForSeconds(1f));

            gameDisplayText.enabled = false;
        }
        else if (currentState == State.battle_end)
        {
            yield return(new WaitForSeconds(1f));

            teamController.SetControlPanelDisplay(false);
            teamController.SetControlButtonDisplay(false);
            chattingPanel.SetChatButtonDisplay(false);
            chattingPanel.SetChatPanelDisplay(false);
            teamController.SetToDefaultSearchMode();

            if (team_blue2.Count > 0)
            {
                gameDisplayText.text = "<color=#00ffffff>Team Blue</color>\nwon!";
                team_blue_score++;
                team_blue2.Clear();
            }
            else if (team_red2.Count > 0)
            {
                gameDisplayText.text = "<color=#ff0000ff>Team Red</color>\nwon!";
                team_red_score++;
                team_red2.Clear();
            }
            else
            {
                team_red_score++;
                team_blue_score++;
                gameDisplayText.text = "<color=#ffff00ff>Draw!</color>";
            }
            StartCoroutine(ClearAllSlime());
            gameDisplayText.enabled = true;
            yield return(new WaitForSeconds(2f));

            gameDisplayText.text = " <color=#ff0000ff>RED</color> | <color=#00ffffff>BLUE</color> \n" + team_red_score + " : " + team_blue_score;
            yield return(new WaitForSeconds(2f));

            gameDisplayText.enabled = false;

            if (team_red_score < winPoint && team_blue_score < winPoint)
            {
                yield return(new WaitForSeconds(0.5f));

                /* Display Rewards Panel */
                nextRoundCostPanel.gameObject.SetActive(true);
                nextRoundCostPanel.TextSetting();
                yield return(new WaitForSeconds(9f));

                nextRoundCostPanel.gameObject.SetActive(false);

                playerStats.NewRoundCostUpdate();
                PlayerShop.Instance.ButtonsUpdate();
                yield return(new WaitForSeconds(0.5f));

                /* sync the GameReady */
                if (PhotonNetwork.isMasterClient)
                {
                    photonView.RPC("RPC_GameReady", PhotonTargets.All);
                }
            }
            else
            {
                yield return(new WaitForSeconds(0.5f));

                /* sync the GameReady */
                if (PhotonNetwork.isMasterClient)
                {
                    photonView.RPC("RPC_GameEnd", PhotonTargets.All);
                }
            }
        }
        else if (currentState == State.game_end)
        {
            string gameWinner = "";
            gameDisplayText.text    = "<size=75>Game End!</size>";
            gameDisplayText.enabled = true;
            yield return(new WaitForSeconds(2f));

            if (team_red_score > team_blue_score)
            {
                gameDisplayText.text = "Winner\n<size=70><color=#ff0000ff>Team Red</color></size>";
                gameWinner           = "red";
                PlayerRecord("Win", "Lose");
            }
            else if (team_red_score < team_blue_score)
            {
                gameDisplayText.text = "Winner\n<size=70><color=#00ffffff>Team Blue</color></size>";
                gameWinner           = "blue";
                PlayerRecord("Lose", "Win");
            }
            else
            {
                gameDisplayText.text = "<size=75><color=#ffff00ff>Draw Game</color></size>";
                gameWinner           = "draw";
                PlayerRecord("Draw", "Draw");
            }
            yield return(new WaitForSeconds(3f));

            gameDisplayText.enabled = false;
            rewardsPanel.gameObject.SetActive(true);
            rewardsPanel.TextSetting();
            rewardsPanel.SetUpWinBouns(gameWinner);
            AudioManager.instance.ChangeTheme("Victory");
        }
    }