Esempio n. 1
0
    public void SetupPlayers()
    {
        /*
         * Initialize the players that will be used in the game
         */

        /* Create the players if they have not yet been created */
        if (players == null)
        {
            players = new Player[playerCount];
        }
        for (int i = 0; i < players.Length; i++)
        {
            if (players[i] == null)
            {
                players[i] = new Player(playerContainer, this);
            }
        }

        /* Set the default controls for the each player */
        for (int i = 0; i < players.Length; i++)
        {
            players[i].SetupControls(i);
        }

        /* Set the sprites used by the players */
        for (int i = 0; i < players.Length; i++)
        {
            players[i].SetupSprite(windowController.GetSprite(i));
        }

        /* Add the players to the lineDrawer so they will render */
        lineDrawer.AddPlayers(players);
    }