Ejemplo n.º 1
0
    // Use this for initialization
    public void SetUp(Faction.FactionType p_faction, int ID, GameObject bossObject)
    {
        //Set ID
        playerID               = ID;
        localPlayerObject      = bossObject;
        publicPlayerAttributes = bossObject.GetComponent <PlayerStatistics>();

        //Create player UI pieces. 7 pieces.
        playerPieces = new PlayerPiece[] { Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>(),
                                           Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>() };

        //Set the faction and tell it to set up an income map.
        faction = Faction.GetNewFaction(p_faction);
        faction.SetUp();

        //Setup playerPieces
        SetUpPieces();

        //points
        pk = new PointKeeper();
        publicPlayerAttributes.CmdSetPoints(20);

        //Shipping & terraform upgrade levels
        shipping = faction.GetDefaultShipping();
        current_upgrade_terraform = 0;

        //Starting list of "built upon" coordinates is empty
        buildingLocs = new List <Coordinate>();

        //Starting cult tracks
        cd = new CultData(faction.Get_Default_CultData());
        publicPlayerAttributes.CmdSetCultStandings(cd.GetLevels());

        //Setup UI to start with
        ui = GameObject.Find("UI").GetComponent <UI_Updater>();
        ui.UpdatePlayerBuildingCosts(faction.Get_cost_build_dwelling(), faction.Get_cost_build_TP(), faction.Get_cost_build_temple(), faction.Get_cost_build_sanctuary(), faction.Get_cost_build_stronghold());
        ui.UpdatePlayerCultText(cd);

        //Starting resources and income and update UI resources/income
        publicPlayerAttributes.CmdSetGold(faction.Starting_gold);
        publicPlayerAttributes.CmdSetWorkers(faction.Starting_worker);
        publicPlayerAttributes.CmdSetPriests(faction.Starting_priest);
        shovel_count = faction.Starting_shovels;

        CalculateIncome();

        tierMagic = faction.GetDefaultMagic(); UpdateMagicPublicVariables();

        PointsForTown = 7;

        //Update the UI after setting up all variables
        UpdateResourceText();
    }