コード例 #1
0
        //init the faction without modifying the faction attributes
        public void Init(int factionID, FactionManager factionMgr, GameManager gameMgr)
        {
            this.ID         = factionID;
            this.FactionMgr = factionMgr;

            FactionMgr.Init(gameMgr, ID, typeInfo ? typeInfo.GetLimits() : null, this); //init the faction manager component of this faction

            //depending on the faction type, add extra units/buildings (if there's actually any) to be created for each faction:
            if (playerControlled == true)                                                //if this faction is player controlled:
            {
                if (typeInfo != null)                                                    //if this faction has a valid type.
                {
                    gameMgr.PlacementMgr.AddBuildingRange(typeInfo.GetExtraBuildings()); //add the extra buildings so that this faction can use them.
                }
            }
            else if (IsNPCFaction() == true) //if this is not controlled by the local player but rather NPC.
            //Init the NPC Faction manager:
            {
                InitNPCMgr(gameMgr);
            }

            Lost = false;

            CustomEvents.OnFactionInit(this);
        }