Exemplo n.º 1
0
    void Start()
    {
        gameStateMachine_Ref = this;

        if (canvas_Ref == null)
        {
            if (transform.GetChild(0).gameObject != null)
            {
                canvas_Ref = transform.GetChild(0).gameObject;
            }
            else
            {
                Debug.Log("GameStateMachine is missing a reference to the Canvas");
            }
        }

        if (gameState == null)
        {
            gameState = new BeginState(this);
        }

        if (bordersParent_Ref == null)
        {
            if (GameObject.Find("BordersParent") != null)
            {
                bordersParent_Ref = GameObject.Find("BordersParent");
            }
            else
            {
                Debug.Log("GameStateMachine is missing a reference to BordersParent");
            }
        }

        if (playerInfoOne_Ref == null)
            Debug.Log("GameStateMachine is missing a reference to playerOneInfo");
        
        if (playerInfoTwo_Ref == null)
            Debug.Log("GameStateMachine is missing a reference to playerTwoInfo");

        playerOneSpawner_Ref.GetComponent<Spawner>().PlayerParent = playerOneParent_Ref;
        playerTwoSpawner_Ref.GetComponent<Spawner>().PlayerParent = playerTwoParent_Ref;

        gameState.ShowIt();

        playerOneBlocksCollected = new bool[playerOneSpawner_Ref.GetComponent<Spawner>().groups.Length];
        playerTwoBlocksCollected = new bool[playerTwoSpawner_Ref.GetComponent<Spawner>().groups.Length];

       if(gamesPlayedBeforeRefill == 0) { gamesPlayedBeforeRefill = 28; }
        inGameUIManager_Ref.UpdatePlayerStatus(WhoIsInTheLead());
    }