예제 #1
0
    void Start()
    {
        for (int i = 0; i < kingdomCount; ++i)
        {
            Kingdom kingdom = new Kingdom();
            kingdoms.Add(kingdom);
            kingdom.id = i;
            kingdom.Initialize();
            kingdomCenters.Add(GameObject.Instantiate(kingdomCenterTemplate));
            kingdomCenters [i].position = kingdom.position;
            kingdomCenters [i].gameObject.SetActive(true);
        }

        if (preSimulate)
        {
            for (int i = 0; i < simulateRounds; ++i)
            {
                if (i == 0)
                {
                    for (int a = 0; a < kingdoms.Count; ++a)
                    {
                        kingdoms [a].population++;
                        kingdoms [a].populationCap++;
                        kingdoms [a].AddUnitToLoiter(UnitTypes.Peasant);
                        kingdoms [a].Simulate();
                    }
                }
                else
                {
                    for (int a = 0; a < kingdoms.Count; ++a)
                    {
                        kingdoms [a].Simulate();
                    }
                }
            }

            gameTime    = simulateRounds;
            prevTime    = gameTime;
            preSimulate = false;
        }
    }