Example #1
0
        public TankController(IPlayStyle playstyle)
        {
            this.playstyle = playstyle;

            csai       = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile    = LogFile.GetInstance();

            unitdefhelp     = new UnitDefHelp(aicallback);
            unitcontroller  = UnitController.GetInstance();
            enemycontroller = EnemyController.GetInstance();
            buildtable      = BuildTable.GetInstance();

            enemyselector = new EnemySelector(110, false, false);

            attackpackcoordinator       = new AttackPackCoordinator(TankDefsById);
            spreadsearchpackcoordinator = new SpreadSearchPackCoordinator(TankDefsById);
            movetopackcoordinator       = new MoveToPackCoordinator(TankDefsById);
            guardpackcoordinator        = new GuardPackCoordinator(TankDefsById);

            packcoordinatorselector = new PackCoordinatorSelector();
            packcoordinatorselector.LoadCoordinator(attackpackcoordinator);
            packcoordinatorselector.LoadCoordinator(spreadsearchpackcoordinator);
            packcoordinatorselector.LoadCoordinator(movetopackcoordinator);
            packcoordinatorselector.LoadCoordinator(guardpackcoordinator);

            logfile.WriteLine("*TankController Initialized*");
        }
        public TankController( IPlayStyle playstyle )
        {
            this.playstyle = playstyle;

            csai = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile = LogFile.GetInstance();

            unitdefhelp = new UnitDefHelp( aicallback );
            unitcontroller = UnitController.GetInstance();
            enemycontroller = EnemyController.GetInstance();
            buildtable = BuildTable.GetInstance();

            enemyselector = new EnemySelector( 110, false, false );

            attackpackcoordinator = new AttackPackCoordinator( TankDefsById );
            spreadsearchpackcoordinator = new SpreadSearchPackCoordinator( TankDefsById );
            movetopackcoordinator = new MoveToPackCoordinator( TankDefsById );
            guardpackcoordinator = new GuardPackCoordinator( TankDefsById );

            packcoordinatorselector = new PackCoordinatorSelector();
            packcoordinatorselector.LoadCoordinator( attackpackcoordinator );
            packcoordinatorselector.LoadCoordinator( spreadsearchpackcoordinator );
            packcoordinatorselector.LoadCoordinator( movetopackcoordinator );
            packcoordinatorselector.LoadCoordinator( guardpackcoordinator );

            logfile.WriteLine( "*TankController Initialized*" );
        }
Example #3
0
        public RadarController( IPlayStyle playstyle )
        {
            this.playstyle = playstyle;

            csai = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile = LogFile.GetInstance();

            unitcontroller = UnitController.GetInstance();
            buildtable = BuildTable.GetInstance();
        }
Example #4
0
        public RadarController(IPlayStyle playstyle)
        {
            this.playstyle = playstyle;

            csai       = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile    = LogFile.GetInstance();

            unitcontroller = UnitController.GetInstance();
            buildtable     = BuildTable.GetInstance();
        }
        public void ListPlayStyles()
        {
            string reply = "Play styles available: ";

            foreach (object playstyleobject in playstyles)
            {
                IPlayStyle playstyle = playstyleobject as IPlayStyle;
                reply += playstyle.GetName() + ", ";
            }
            aicallback.SendTextMsg(reply, 0);
            aicallback.SendTextMsg(".csai chooseplaystyle <name> to choose", 0);
        }
 public void RegisterPlayStyle(IPlayStyle playstyle)
 {
     if (!playstyles.Contains(playstyle))
     {
         logfile.WriteLine("PlayStyleManager: registering playstyle " + playstyle.GetName());
         playstyles.Add(playstyle);
         //if( playstyle.GetName().ToLower() == defaultplaystylename )
         //{
         //  currentplaystyle = playstyle;
         // playstyle.Activate();
         // }
     }
 }
Example #7
0
        public FactoryController( IPlayStyle playstyle )
        {
            this.playstyle = playstyle;

            csai = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile = LogFile.GetInstance();
            buildtable = BuildTable.GetInstance();
            unitcontroller = UnitController.GetInstance();

            unitdefhelp = new UnitDefHelp( aicallback );

            csai.RegisterVoiceCommand( "dumpfactories", new CSAI.VoiceCommandHandler( DumpFactories ) );
        }
Example #8
0
        public Hashtable FactoriesByTypeName        = new Hashtable(); // deployedid of factories hashed by typename (eg "armvp")

        public FactoryController(IPlayStyle playstyle)
        {
            this.playstyle = playstyle;

            csai           = CSAI.GetInstance();
            aicallback     = csai.aicallback;
            logfile        = LogFile.GetInstance();
            buildtable     = BuildTable.GetInstance();
            unitcontroller = UnitController.GetInstance();

            unitdefhelp = new UnitDefHelp(aicallback);

            csai.RegisterVoiceCommand("dumpfactories", new CSAI.VoiceCommandHandler(DumpFactories));
        }
        public ScoutControllerRandomSearch(IPlayStyle playstyle)
        {
            random = new Random();

            this.playstyle = playstyle;

            csai       = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile    = LogFile.GetInstance();

            unitcontroller = UnitController.GetInstance();
            buildtable     = BuildTable.GetInstance();

            searchcoordinator = new SpreadSearchPackCoordinatorWithSearchGrid(ScoutUnitDefsById);

            logfile.WriteLine("*ScoutController initialized*");
        }
        public ScoutControllerRandomSearch( IPlayStyle playstyle )
        {
            random = new Random();

            this.playstyle = playstyle;

            csai = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile = LogFile.GetInstance();

            unitcontroller = UnitController.GetInstance();
            buildtable = BuildTable.GetInstance();

            searchcoordinator = new SpreadSearchPackCoordinatorWithSearchGrid( ScoutUnitDefsById );

            logfile.WriteLine( "*ScoutController initialized*" );
        }
Example #11
0
        public ConstructorController(IPlayStyle playstyle)
        {
            this.playstyle = playstyle;

            csai       = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile    = LogFile.GetInstance();

            ShowNextBuildSite = csai.DebugOn;

            unitcontroller = UnitController.GetInstance();
            // factorycontroller = FactoryController.GetInstance();
            buildtable = BuildTable.GetInstance();
            metal      = Metal.GetInstance();

            ShowNextBuildSite = csai.DebugOn;
            logfile.WriteLine("ConstructorController::ConstructorController() finished");
        }
Example #12
0
        public ConstructorController( IPlayStyle playstyle )
        {
            this.playstyle = playstyle;

            csai = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile = LogFile.GetInstance();

            ShowNextBuildSite = csai.DebugOn;

            unitcontroller = UnitController.GetInstance();
            // factorycontroller = FactoryController.GetInstance();
            buildtable = BuildTable.GetInstance();
            metal = Metal.GetInstance();

            ShowNextBuildSite = csai.DebugOn;
            logfile.WriteLine("ConstructorController::ConstructorController() finished" );
        }
        public void ChoosePlayStyle(string playstylename)
        {
            IPlayStyle requestedstyle = null;

            foreach (object playstyleobject in playstyles)
            {
                IPlayStyle playstyle = playstyleobject as IPlayStyle;
                if (playstyle.GetName().ToLower() == playstylename.ToLower())
                {
                    requestedstyle = playstyle;
                }
            }

            if (requestedstyle != null)
            {
                aicallback.SendTextMsg("Activating play style " + requestedstyle.GetName(), 0);
                logfile.WriteLine("Activating play style " + requestedstyle.GetName());
            }
            else
            {
                aicallback.SendTextMsg("Playstyle " + playstylename + " not found", 0);
                return;
            }

            foreach (object playstyleobject in playstyles)
            {
                IPlayStyle playstyle = playstyleobject as IPlayStyle;
                if (playstyle != requestedstyle)
                {
                    playstyle.Disactivate();
                }
            }
            requestedstyle.Activate();
            currentplaystyle = requestedstyle;
            logfile.WriteLine("ChoosePlayStyle done");
        }
Example #14
0
        // int terrainwidth;
        // int terrainheight;
        public ScoutControllerRaider( IPlayStyle playstyle )
        {
            this.playstyle = playstyle;

            csai = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile = LogFile.GetInstance();

            random = new Random();

            //terrainwidth = aicallback.GetMapWidth() * MovementMaps.SQUARE_SIZE;
               // terrainheight = aicallback.GetMapHeight() * MovementMaps.SQUARE_SIZE;

            //int[,] sectorlastcheckedtickcount = new int[ terrainwidth, terrainheight ];
               // bool[,] sectorispriority = new bool[ terrainwidth, terrainheight ];;

            unitcontroller = UnitController.GetInstance();
            buildtable = BuildTable.GetInstance();
            enemycontroller = EnemyController.GetInstance();

            searchcoordinator = new SpreadSearchPackCoordinatorWithSearchGrid( ScoutUnitDefsById );

            logfile.WriteLine( "*ScoutControllerRaider initialized*" );
        }
Example #15
0
        // int terrainwidth;
        // int terrainheight;

        public ScoutControllerRaider(IPlayStyle playstyle)
        {
            this.playstyle = playstyle;

            csai       = CSAI.GetInstance();
            aicallback = csai.aicallback;
            logfile    = LogFile.GetInstance();

            random = new Random();

            //terrainwidth = aicallback.GetMapWidth() * MovementMaps.SQUARE_SIZE;
            // terrainheight = aicallback.GetMapHeight() * MovementMaps.SQUARE_SIZE;

            //int[,] sectorlastcheckedtickcount = new int[ terrainwidth, terrainheight ];
            // bool[,] sectorispriority = new bool[ terrainwidth, terrainheight ];;

            unitcontroller  = UnitController.GetInstance();
            buildtable      = BuildTable.GetInstance();
            enemycontroller = EnemyController.GetInstance();

            searchcoordinator = new SpreadSearchPackCoordinatorWithSearchGrid(ScoutUnitDefsById);

            logfile.WriteLine("*ScoutControllerRaider initialized*");
        }
 public BuildEconomyController( IPlayStyle playstyle )
 {
     this.playstyle = playstyle;
     UnitController.GetInstance();
 }
Example #17
0
 public void RegisterPlayStyle( IPlayStyle playstyle )
 {
     if( !playstyles.Contains( playstyle ) )
     {
         logfile.WriteLine( "PlayStyleManager: registering playstyle " + playstyle.GetName() );
         playstyles.Add( playstyle );
         //if( playstyle.GetName().ToLower() == defaultplaystylename )
         //{
           //  currentplaystyle = playstyle;
            // playstyle.Activate();
        // }
     }
 }
Example #18
0
        public void ChoosePlayStyle( string playstylename )
        {
            IPlayStyle requestedstyle = null;
            foreach( object playstyleobject in playstyles )
            {
                IPlayStyle playstyle = playstyleobject as IPlayStyle;
                if( playstyle.GetName().ToLower() == playstylename.ToLower() )
                {
                    requestedstyle = playstyle;
                }
            }

            if( requestedstyle != null )
            {
                aicallback.SendTextMsg( "Activating play style " + requestedstyle.GetName(), 0 );
                logfile.WriteLine( "Activating play style " + requestedstyle.GetName() );
            }
            else
            {
                aicallback.SendTextMsg( "Playstyle " + playstylename + " not found", 0 );
                return;
            }

            foreach( object playstyleobject in playstyles )
            {
                IPlayStyle playstyle = playstyleobject as IPlayStyle;
                if( playstyle != requestedstyle )
                {
                    playstyle.Disactivate();
                }
            }
            requestedstyle.Activate();
            currentplaystyle = requestedstyle;
            logfile.WriteLine( "ChoosePlayStyle done" );
        }
Example #19
0
 public BuildEconomyController(IPlayStyle playstyle)
 {
     this.playstyle = playstyle;
     UnitController.GetInstance();
 }