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; } }
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; } }
public void Activate() { if (!Active) { unitcontroller.UnitAddedEvent += new UnitController.UnitAddedHandler(unitcontroller_UnitAddedEvent); unitcontroller.UnitRemovedEvent += new UnitController.UnitRemovedHandler(unitcontroller_UnitRemovedEvent); foreach (IFactoryController factorycontroller in playstyle.GetControllersOfType(typeof(IFactoryController))) { factorycontroller.RegisterRequester(this); } Active = true; } }
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; } }
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; } }