Ejemplo n.º 1
0
        public void Activate()
        {
            if (!Active)
            {
                csai.UnitIdleEvent += new CSAI.UnitIdleHandler(UnitIdle);

                foreach (IFactoryController factorycontroller in playstyle.GetControllersOfType(typeof(IFactoryController)))
                {
                    factorycontroller.RegisterRequester(this);
                }

                // unitcontroller.UnitAddedEvent += new UnitController.UnitAddedHandler( UnitAdded );
                unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler(UnitRemoved);
                FactoryUnitDefByDeployedId.Clear();
                unitcontroller.RefreshMyMemory(new UnitController.UnitAddedHandler(UnitAdded));

                /*
                 * foreach( DictionaryEntry de in unitcontroller.UnitDefByDeployedId )
                 * {
                 *  int deployedid = (int)de.Key;
                 *  IUnitDef unitdef = de.Value as IUnitDef;
                 *  if( unitdefhelp.IsFactory( unitdef ) && !FactoryUnitDefByDeployedId.Contains( deployedid ) )
                 *  {
                 *      FactoryUnitDefByDeployedId.Add( deployedid, unitdef );
                 *      logfile.WriteLine( "Existing factory: " + unitdef.humanName + " id " + deployedid );
                 *  }
                 * }
                 */

                Active = true;
            }
        }
Ejemplo n.º 2
0
        public void Activate()
        {
            if (!Active)
            {
                factorycontroller = playstyle.GetFirstControllerOfType(typeof(IFactoryController)) as IFactoryController;
                factorycontroller.RegisterRequester(this);

                enemycontroller.NewEnemyAddedEvent += new EnemyController.NewEnemyAddedHandler(EnemyAdded);
                enemycontroller.EnemyRemovedEvent  += new EnemyController.EnemyRemovedHandler(EnemyRemoved);

                csai.TickEvent     += new CSAI.TickHandler(Tick);
                csai.UnitIdleEvent += new CSAI.UnitIdleHandler(UnitIdle);

                csai.RegisterVoiceCommand("tankscount", new CSAI.VoiceCommandHandler(VoiceCommandCountTanks));
                csai.RegisterVoiceCommand("tanksmoveto", new CSAI.VoiceCommandHandler(VoiceCommandMoveTo));
                csai.RegisterVoiceCommand("tanksattackpos", new CSAI.VoiceCommandHandler(VoiceCommandAttackPos));

                //      unitcontroller.UnitAddedEvent += new UnitController.UnitAddedHandler( UnitAdded );
                unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler(UnitRemoved);
                TankDefsById.Clear(); // note, dont just make a new one, because searchpackcoordinator wont get new one
                unitcontroller.RefreshMyMemory(new UnitController.UnitAddedHandler(UnitAdded));

                //PackCoordinatorSelector.Activate();
                Active = true;
            }
        }
Ejemplo n.º 3
0
        public void Activate()
        {
            if (!Active)
            {
                logfile.WriteLine("Activating Constructorcontroller");

                foreach (IFactoryController factorycontroller in playstyle.GetControllersOfType(typeof(IFactoryController)))
                {
                    factorycontroller.RegisterRequester(this);
                }

                radarcontroller = playstyle.GetFirstControllerOfType(typeof(IRadarController)) as IRadarController;

                csai.UnitIdleEvent       += new CSAI.UnitIdleHandler(UnitIdle);
                csai.TickEvent           += new CSAI.TickHandler(Tick);
                csai.UnitMoveFailedEvent += new CSAI.UnitMoveFailedHandler(UnitMoveFailed);

                csai.RegisterVoiceCommand("constructorshownextbuildsiteon", new CSAI.VoiceCommandHandler(VoiceCommandShowNextBuildSiteOn));
                csai.RegisterVoiceCommand("constructorshownextbuildsiteoff", new CSAI.VoiceCommandHandler(VoiceCommandShowNextBuildSiteOff));

                unitcontroller.UnitAddedEvent   += new UnitController.UnitAddedHandler(UnitAdded);
                unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler(UnitRemoved);
                UnitDefByUnitId.Clear(); // note, dont just make a new one, because searchpackcoordinator wont get new one
                unitcontroller.RefreshMyMemory(new UnitController.UnitAddedHandler(UnitAdded));

                CheckIdleUnits();

                logfile.WriteLine("Constructorcontroller activated");
                Active = true;
            }
        }
Ejemplo n.º 4
0
        public void Activate()
        {
            if (!Active)
            {
                foreach (IFactoryController factorycontroller in playstyle.GetControllersOfType(typeof(IFactoryController)))
                {
                    factorycontroller.RegisterRequester(this);
                }

                //unitcontroller.UnitAddedEvent += new UnitController.UnitAddedHandler( UnitAdded );
                unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler(UnitRemoved);
                Radars.Clear(); // note, dont just make a new one, because searchpackcoordinator wont get new one
                unitcontroller.RefreshMyMemory(new UnitController.UnitAddedHandler(UnitAdded));
                Active = true;
            }
        }
Ejemplo n.º 5
0
        public void Activate()
        {
            if (!Active)
            {
                csai.TickEvent += new CSAI.TickHandler(Tick);
                csai.RegisterVoiceCommand("countscouts", new CSAI.VoiceCommandHandler(VoiceCommandCountScouts));

                enemycontroller.NewEnemyAddedEvent += new EnemyController.NewEnemyAddedHandler(EnemyAdded);

                unitcontroller.UnitAddedEvent   += new UnitController.UnitAddedHandler(UnitAdded);
                unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler(UnitRemoved);
                ScoutUnitDefsById.Clear(); // note, dont just make a new one, because searchpackcoordinator wont get new one
                unitcontroller.RefreshMyMemory(new UnitController.UnitAddedHandler(UnitAdded));

                searchcoordinator.Activate();
                Active = true;
            }
        }
        public void Activate()
        {
            if (!started)
            {
                started            = true;
                restartedfrompause = true;

                groupid = aicallback.CreateGroup("", 0);
                logfile.WriteLine("ATCUG created group id " + groupid);

                unitcontroller = UnitController.GetInstance();

                unitcontroller.UnitAddedEvent += new UnitController.UnitAddedHandler(UnitAdded);
                //unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler( UnitRemoved );
                //ScoutUnitDefsById.Clear(); // note, dont just make a new one, because searchpackcoordinator wont get new one
                unitcontroller.RefreshMyMemory(new UnitController.UnitAddedHandler(UnitAdded));

                Recoordinate();
            }
        }
        public void Activate()
        {
            if (!Active)
            {
                foreach (IFactoryController factorycontroller in playstyle.GetControllersOfType(typeof(IFactoryController)))
                {
                    factorycontroller.RegisterRequester(this);
                }

                csai.TickEvent += new CSAI.TickHandler(Tick);
                csai.RegisterVoiceCommand("countscouts", new CSAI.VoiceCommandHandler(VoiceCommandCountScouts));

                unitcontroller.UnitAddedEvent   += new UnitController.UnitAddedHandler(UnitAdded);
                unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler(UnitRemoved);
                ScoutUnitDefsById.Clear(); // note, dont just make a new one, because searchpackcoordinator wont get new one
                unitcontroller.RefreshMyMemory(new UnitController.UnitAddedHandler(UnitAdded));

                searchcoordinator.Activate();
                Active = true;
            }
        }
Ejemplo n.º 8
0
        public void Activate()
        {
            if( !started )
            {
                started = true;
                restartedfrompause = true;

                groupid = aicallback.CreateGroup( "", 0 );
                logfile.WriteLine( "ATCUG created group id " + groupid );

                unitcontroller = UnitController.GetInstance();

                unitcontroller.UnitAddedEvent += new UnitController.UnitAddedHandler( UnitAdded );
                //unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler( UnitRemoved );
                //ScoutUnitDefsById.Clear(); // note, dont just make a new one, because searchpackcoordinator wont get new one
                unitcontroller.RefreshMyMemory( new UnitController.UnitAddedHandler( UnitAdded ) );

                Recoordinate();
            }
        }