Exemplo n.º 1
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 (!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;
            }
        }