Exemple #1
0
    public IEnumerator StartMatch()
    {
        yield return(new WaitForSeconds(1f));

        shop.gameObject.SetActive(false);

        player1.SetActive(true);
        player1.transform.position = Vector3.left * 3;
        player2.SetActive(true);
        player2.transform.position = Vector3.right * 3;

        player1Health.gameObject.SetActive(true);
        player2Health.gameObject.SetActive(true);

        cageManager.CallTimer();

        if (!skipRoundDisplay)
        {
            roundDisplay.gameObject.SetActive(true);
            roundDisplay.SetValues("First to win " + Match.maxScore, Match.player1Score, Match.player2Score);
            state = State.Intro;

            yield return(new WaitForSeconds(2f));

            roundDisplay.gameObject.SetActive(false);
            battleStartPanel.gameObject.SetActive(true);
            battleStartPanel.Call();
        }
        soundtrackManager.SetFocus(false);
        player1.GetComponent <Player>().SetIdleState();
        player2.GetComponent <Player>().SetIdleState();
        state = State.Playing;
    }
Exemple #2
0
    void Start()
    {
        sceneTransition   = SceneTransition.instance;
        soundtrackManager = SoundtrackManager.instance;

        player1 = Instantiate(playerPrefab, Vector3.left * 3, Quaternion.identity, transform);
        player2 = Instantiate(playerPrefab, Vector3.right * 3, Quaternion.identity, transform);
        Destroy(playerPrefab);

        player1Health.matchManager = this;
        player2Health.matchManager = this;

        PlayerConfigurations.BaseSetup();
        //PlayerConfigurations.player1.color = player1Color;
        //PlayerConfigurations.player2.color = player2Color;
        player1Color = PlayerConfigurations.player1.color;
        player2Color = PlayerConfigurations.player2.color;

        player1.GetComponent <Player>().Init(1, player1input = PlayerConfigurations.player1.input, player1Color, player1Health);
        player2.GetComponent <Player>().Init(2, player2input = PlayerConfigurations.player2.input, player2Color, player2Health);
        battleStartPanel.HideAll();

        player1.SetActive(false);
        player2.SetActive(false);

        if (!skipShop)
        {
            roundDisplay.gameObject.SetActive(false);
            if (shop)
            {
                if (!soundtrackManager.PlayFadedBattleTheme(1))
                {
                    soundtrackManager.SetFocus(true);
                }

                shop.gameObject.SetActive(true);
                shop.Setup(this, player1.GetComponent <Player>(), player2.GetComponent <Player>());
            }
            shop.ProhibitSetup(Match.lastWinnerID);
            state = State.Shop;
        }
        else
        {
            StartCoroutine(StartMatch());
        }
    }