TankRush() { strategycontroller = StrategyController.GetInstance(); strategycontroller.RegisterStrategy( this.GetType().ToString(), this ); unitcontroller = UnitController.GetInstance(); unitcontroller.ExistingUnitEvent += new UnitController.ExistingUnitHandler(unitcontroller_ExistingUnitEvent); }
TankRush() { strategycontroller = StrategyController.GetInstance(); strategycontroller.RegisterStrategy( this.GetType().ToString(), this ); unitcontroller = UnitController.GetInstance(); }
//int numOfUnits = 0; //IUnitDef[] unitList; //IUnitDef solarcollectordef; public void InitAI(IAICallback aicallback, int team) { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); this.aicallback = aicallback; try{ this.Team = team; logfile = LogFile.GetInstance().Init(team); logfile.WriteLine("C# AI started v" + AIVersion + ", team " + team + " ref " + reference + " map " + aicallback.GetMapName() + " mod " + aicallback.GetModName()); if (File.Exists("AI/CSAI/debug.flg")) // if this file exists, activate debug mode; saves manually changing this for releases { logfile.WriteLine("Toggling debug on"); DebugOn = true; } if (DebugOn) { new Testing.RunTests().Go(); } InitCache(); PlayStyleManager.GetInstance(); LoadPlayStyles.Go(); metal = Metal.GetInstance(); CommanderController.GetInstance(); BuildTable.GetInstance(); UnitController.GetInstance(); EnemyController.GetInstance(); EnergyController.GetInstance(); MovementMaps.GetInstance(); BuildMap.GetInstance(); //FactoryController.GetInstance(); //RadarController.GetInstance(); //TankController.GetInstance(); //ScoutController.GetInstance(); //ConstructorController.GetInstance(); metal.Init(); BuildPlanner.GetInstance(); UnitController.GetInstance().LoadExistingUnits(); // need this if we're being reloaded in middle of a game, to get already existing units EnemyController.GetInstance().LoadExistingUnits(); StrategyController.GetInstance(); LoadStrategies.Go(); PlayStyleManager.GetInstance().ChoosePlayStyle("tankrush"); if (aicallback.GetModName().ToLower().IndexOf("aass") == 0 || aicallback.GetModName().ToLower().IndexOf("xtape") == 0) { aicallback.SendTextMsg("C# AI initialized v" + AIVersion + ", team " + team, 0); aicallback.SendTextMsg("Please say '.csai help' for available commands", 0); PlayStyleManager.GetInstance().ListPlayStyles(); //CommanderController.GetInstance().CommanderBuildPower(); } else { aicallback.SendTextMsg("Warning: CSAI needs AA2.23 or XTA7 to run correctly at this time", 0); logfile.WriteLine("*********************************************************"); logfile.WriteLine("*********************************************************"); logfile.WriteLine("**** ****"); logfile.WriteLine("**** Warning: CSAI needs AA2.23 or XTA7 to run correctly at this time ****"); logfile.WriteLine("**** ****"); logfile.WriteLine("*********************************************************"); logfile.WriteLine("*********************************************************"); } } catch (Exception e) { logfile.WriteLine("Exception: " + e.ToString()); aicallback.SendTextMsg("Exception: " + e.ToString(), 0); } }
TankRush() { strategycontroller = StrategyController.GetInstance(); strategycontroller.RegisterStrategy(this.GetType().ToString(), this); unitcontroller = UnitController.GetInstance(); }