Beispiel #1
0
    protected virtual void InitializeGame()
    {
        Player player1 = Instantiate(player, transform.position + new Vector3(0, cannonHeight, -gameAreaLength), Quaternion.identity).GetComponent <Player>();

        player1.playerMaterial = materialBlue;
        CannonController cannon1 = player1.GetComponentInChildren <CannonController>();

        //TODO:temp
        cannon1.GetComponentInChildren <MeshRenderer>().material = materialBlue;
        cannon1.player           = player1;
        cannon1.projectilePrefab = projectileBlue;
        cannon1.game             = this;
        cannon1.uiManager        = uiManager;
        cannons.Add(cannon1);
        cannons[0].player.playerType = PlayerType.ONE;

        Player player2 = Instantiate(player, transform.position + new Vector3(0, cannonHeight, gameAreaLength), Quaternion.Euler(new Vector3(0, 180, 0))).GetComponent <Player>();

        player2.playerMaterial = materialRed;
        CannonController cannon2 = player2.GetComponentInChildren <CannonController>();

        //TODO:temp
        cannon2.GetComponentInChildren <MeshRenderer>().material = materialRed;
        cannon2.player           = player2;
        cannon2.projectilePrefab = projectileRed;
        cannon2.game             = this;
        cannon2.uiManager        = uiManager;
        cannons.Add(cannon2);
        cannons[1].player.playerType = PlayerType.TWO;
    }