예제 #1
0
        /// <summary>
        /// Spusti sekvencne vsetky fazy - az po skonceni ich volanych metod sa spusti dalsia faza.
        /// </summary>
        public void RunTests()
        {
            bool result;

            // Initialization
            RegisteredEvents.Initialize();

            // Creating Model
            Model.Instance.Buildings.Add(new BaseCenter(PlaceType.NearBase));
            Model.Instance.Units.Add(new Worker(PlaceType.NearBase));

            Log.i(null, "----------------------------------");
            Log.i(null, ">>  Starting a new Test Round.  <<");
            Log.i(null, "----------------------------------");

            var battleStage = new NextStageStarter(() =>
            {
                Log.i(this, "Starting Battle Stage");
                var battle = new BattleTest();
                result     = Battle(battle, () => { });
                Log.i(battle, "End of Battle Stage: " + SuccessString(result));
            });

            var buildingStage = new NextStageStarter(() =>
            {
                Log.i(this, "Starting Building Stage");
                var building = new BuildingTest();
                result       = Building(building, battleStage);
                Log.i(building, "End of Building Stage: " + SuccessString(result));
            });

            var economyStage = new NextStageStarter(() =>
            {
                Log.i(this, "Starting Economy Stage");
                var economy = new EconomyTest();
                result      = Economy(economy, buildingStage);
                Log.i(economy, "End of Economy Stage: " + SuccessString(result));
            });

            economyStage();

            Log.i(null, "");
            Log.i(null, ">>   End of a Planning Phase.   <<");
            Log.i(null, "");

            var gameTimer = new GameTimer();

            gameTimer.RunGame(() =>
            {
                if (gameTimer.Cycle >= 500)
                {
                    return(true);
                }
                return(false);
            });

            Log.i(null, "");
            Log.i(null, ">>   End of Game.   <<");
            Log.i(null, "");
        }
예제 #2
0
        public void RunPlayerTest()
        {
            Log.d(">>  Starting a Planning Phase.  <<");

            var end = new Action(() => { Log.d(">>   End of a Planning Phase.   <<"); });

            if (_playerBotData == null)
            {
                _playerBotData = ScriptableObject.CreateInstance <MyBotData>();
            }

            var battleStage = new Action(() =>
            {
                Log.d(this, "Starting Battle Stage");
                if (_playerBattleTest == null)
                {
                    _playerBattleTest = ScriptableObject.CreateInstance <BattleTest>();
                }
                _playerBattleTest.MyBotData = _playerBotData;
                _playerBattleTest.BattleStage(end);
            });

            var buildingStage = new Action(() =>
            {
                Log.d(this, "Starting Building Stage");
                if (_playerBuildingTest == null)
                {
                    _playerBuildingTest = ScriptableObject.CreateInstance <BuildingTest>();
                }
                _playerBuildingTest.MyBotData = _playerBotData;
                _playerBuildingTest.BuildingStage(battleStage);
            });

            var economyStage = new Action(() =>
            {
                if (_playerEconomyTest == null)
                {
                    _playerEconomyTest = ScriptableObject.CreateInstance <EconomyTest>();
                }
                _playerEconomyTest.MyBotData = _playerBotData;
                _playerEconomyTest.EconomyStage(buildingStage);
            });

            economyStage();
        }
예제 #3
0
    void Start()
    {
        ResourceManager.LoadAllResources();
        Instance = this;
        GameGen  = new GameGenerator2(0);
        GameGen.GenerateWorld();



        Caravans = new Dictionary <EntityGroup, GameObject>();

        Image.texture = GameGen.TerGen.ToTexture();
        GenMeshes();
        KingdomMap.texture = GameGen.KingdomGen.ToTexture();
        ContourMap.texture = GameGen.TerGen.DrawContours();
        foreach (GridPoint gp in GameGen.GridPlacement.GridPoints)
        {
            if (gp == null)
            {
                continue;
            }
            Vec2i      pos = gp.ChunkPos;
            GameObject t   = Instantiate(GridPoint);
            t.transform.SetParent(Image.transform, false);
            t.transform.localPosition = new Vector3(pos.x - World.WorldSize / 2, pos.z - World.WorldSize / 2, 0);
            (t.GetComponent <GridPointTest>()).SetPoint(gp);
            //Gizmos.DrawCube(new Vector3(pos.x, pos.z, -1), Vector3.one);
        }
        return;

        foreach (EntityGroup c in WorldEventManager.Instance.EntityGroups)
        {
            GameObject obj = Instantiate(Caravan);
            obj.transform.SetParent(Image.transform, false);
            Vec2i pos = c.CurrentChunk;
            obj.transform.localPosition = new Vector3(pos.x - World.WorldSize / 2, pos.z - World.WorldSize / 2, 0);
            Caravans.Add(c, obj);

            obj.GetComponent <EntityGroupDisplay>().SetEntityGroup(c);
        }
    }
예제 #4
0
 bool Economy(EconomyTest economy, NextStageStarter startNextStage)
 {
     economy.EconomyStage(startNextStage);
     return(true);
 }