Ejemplo n.º 1
0
        //Randomize the order of the factions inside the faction order:
        private void RandomizePlayerFaction()
        {
            //if it is allowed to randomize player faction.
            if (randomPlayerFaction == true)
            {
                //swap faction slots randomly.
                for (int i = 0; i < Factions.Count; i++)
                {
                    //randomly a faction ID to swap with
                    int swapID = Random.Range(0, Factions.Count);

                    //if it's not the same faction:
                    if (i != swapID)
                    {
                        //swap capital building & NPC Manager prefabs:
                        RTSHelper.Swap <Building>(ref Factions[swapID].CapitalBuilding, ref Factions[i].CapitalBuilding);
                        RTSHelper.Swap <NPCManager>(ref Factions[swapID].npcMgr, ref Factions[i].npcMgr);
                    }
                }
            }
        }