Beispiel #1
0
        public void StartDefenseMission(CampaignMissionVO mission)
        {
            if (this.activeDefenseBattle)
            {
                Service.Logger.WarnFormat("Mission {0} is already in progress.  Cannot start Mission {1}.", new object[]
                {
                    this.currentMission.Uid,
                    mission.Uid
                });
                return;
            }
            this.troopController     = Service.TroopController;
            this.eventManager        = Service.EventManager;
            this.activeDefenseBattle = true;
            this.autoMoveCamera      = false;
            this.currentMission      = mission;
            this.randomizeWaves      = !mission.FixedWaves;
            this.waves         = DefensiveBattleController.ParseWaves(this.currentMission.Waves);
            this.wavesDeployed = 0;
            this.waveCount     = this.waves.Count;
            this.AllWavesClear = false;
            if (mission.IsRaidDefense())
            {
                Service.RaidDefenseController.OnStartRaidDefenseMission();
            }
            this.eventManager.RegisterObserver(this, EventId.EntityKilled, EventPriority.BeforeDefault);
            this.eventManager.RegisterObserver(this, EventId.UserStartedCameraMove, EventPriority.Default);
            this.eventManager.RegisterObserver(this, EventId.CameraFinishedMoving, EventPriority.Default);
            this.eventManager.RegisterObserver(this, EventId.PreEntityKilled, EventPriority.Default);
            this.eventManager.RegisterObserver(this, EventId.EntityHit, EventPriority.Default);
            TrapViewController  trapViewController = Service.TrapViewController;
            NodeList <TrapNode> trapNodeList       = Service.BuildingLookupController.TrapNodeList;

            for (TrapNode trapNode = trapNodeList.Head; trapNode != null; trapNode = trapNode.Next)
            {
                trapViewController.UpdateTrapVisibility((SmartEntity)trapNode.Entity);
            }
            Vector3 zero = Vector3.zero;

            Service.WorldInitializer.View.ZoomTo(0.7f);
            Service.WorldInitializer.View.PanToLocation(zero);
            this.DeployNextWave(0u, null);
        }
 public unsafe static long $Invoke12(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(DefensiveBattleController.ParseWaves(Marshal.PtrToStringUni(*(IntPtr *)args))));
 }