/// <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, ""); }
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(); }
bool Building(BuildingTest building, NextStageStarter startNextStage) { building.BuildingStage(startNextStage); return(true); }