IEnumerator <bool> Initialize() { antennaComms = new ACPWrapper(this); yield return(true); missileManagement = new MissileManagement(antennaComms); missileManagement.OnMissileAdded += OnMissileAdded; missileManagement.OnMissileRemoved += OnMissileRemoved; yield return(true); MissileCoordination.TargetFilter filter = new MissileCoordination.TargetFilter(1, new MyDetectedEntityType[] { MyDetectedEntityType.LargeGrid, MyDetectedEntityType.SmallGrid }); missileCoordination = new MissileCoordination(missileManagement, Me, antennaComms, filter); yield return(true); turretMonitor = new TurretMonitor(this); turretMonitor.OnTargetDetected += OnTargetDetected; turretMonitor.OnTargetDetected += missileCoordination.OnTargetDetected; yield return(true); Echo("Initialized!"); }
IEnumerator <bool> Initialize() { cameras = new List <IMyCameraBlock>(); GridTerminalSystem.GetBlocksOfType(cameras, x => x.CubeGrid == Me.CubeGrid); foreach (var cam in cameras) { cam.EnableRaycast = true; } yield return(true); gyros = new List <IMyGyro>(); GridTerminalSystem.GetBlocksOfType(gyros, x => x.CubeGrid == Me.CubeGrid); yield return(true); antennaComms = new ACPWrapper(this, x => x.CubeGrid == Me.CubeGrid); yield return(true); thrusters = new List <IMyThrust>(); GridTerminalSystem.GetBlocksOfType(thrusters, x => x.CubeGrid == Me.CubeGrid); yield return(true); rc = GetBlockWithNameOnGrid(RCNAME) as IMyRemoteControl; yield return(true); mainCam = GetBlockWithNameOnGrid(MAINCAM) as IMyCameraBlock; yield return(true); var GTSUtils = new GridTerminalSystemUtils(Me, GridTerminalSystem); ingameTime = new IngameTime(); yield return(true); entityTracking = new EntityTracking_Module(GTSUtils, rc, mainCam); yield return(true); var pid = new PID_Controller.PIDSettings { PGain = 1 }; autopilot = new Autopilot_Module(GTSUtils, rc, ingameTime, pid, pid, entityTracking); yield return(true); flightControl = new FlightControl(rc, gyros, thrusters, autopilot); yield return(true); guidance = new TargetGuidance(rc); yield return(true); clientSystem = new MissileManagementClient(antennaComms, rc, Me.EntityId, missileType); yield return(true); turretMonitor = new TurretMonitor(this); turretMonitor.OnTargetDetected += OnTargetDetected; yield return(true); proximityFuse = new ProximityFuse(rc, DETONATIONDIST, this); proximityFuse.OnEnemyInRange += proximityFuse.Detonate; DebugEcho("Initialized!"); }