void Start()
    {
        scores = new int[GameControl.instance.numOfPlayers];

        scoreBarUI = scoreBar.GetComponent <ScoreBarUI> ();
        scoreBarUI.ShowBars();
    }
    //Called when minigames begin
    public void StartMinigame()
    {
        minigameOver = false;

        //Find and attach players
        //FindPlayers ();

        //Also find ui and powerupcontrol
        ui = GameObject.Find("UI").GetComponent <UI> ();
        //pauseUI = GameObject.Find ("PauseUI");
        powerupControl = GameObject.Find("PowerupControl").GetComponent <PowerupControl> ();

        //Find scoreBar
        ScoreBarUI scoreBar = ui.GetComponentInChildren <ScoreBarUI>();

        //If the minigame isn't fruit forecast or color craze, disable it
        if (!SceneManager.GetActiveScene().name.Equals(GameInformation.fruitForecast) &&
            !SceneManager.GetActiveScene().name.Equals(GameInformation.colorCraze))
        {
            scoreBar.HideBars();
        }

        //Apply previous powerup
        if (activePowerup != null)
        {
            powerupControl.ActivatePowerup();
        }
    }
Exemple #3
0
    //Placed in init because playerTiles[i] line has to be called AFTER GC has found the players
    public void Init()
    {
        //Enable player changetilecolor script

        /*for (int i = 0; i < GameControl.instance.numOfPlayers; i++) {
         *              GameControl.instance.players [i].GetComponent<ChangeTileColor> ().enabled = true;
         *      }*/

        //Create array of player Tiles
        playerTiles = new TileBase[GameControl.instance.numOfPlayers];

        //For each player, find the object and get their tile object
        for (int i = 0; i < playerTiles.Length; i++)
        {
            playerTiles[i] = GameControl.instance.players[i].GetComponent <ChangeTileColor>().changedTile;
        }

        //Set up points
        points = new int[playerTiles.Length];

        scoreBarUI = scoreBar.GetComponent <ScoreBarUI>();

        //scoreBarUI.ShowBars ();
    }