void Start() { maxNumScenes = SceneManager.sceneCountInBuildSettings; audio = GetComponent <AudioSource>(); thrusterControl = thrusters.GetComponent <ThrusterControl>(); turretControl = turret.GetComponent <BoosterTurretControl>(); state = RocketState.Alive; }
Program() { gridSystem = GridTerminalSystem; gridId = Me.CubeGrid.EntityId; rc = GetBlock <IMyRemoteControl>(); thrust = new ThrusterControl(); gyros = new GyroControl(); Runtime.UpdateFrequency = UpdateFrequency.Update1; Clock.Initialize(UpdateFrequency.Update1); }
public Program() { settings = new Settings(Me); settings.Load(); storage = new StorageData(this); storage.Load(); transmitTag += settings.followerSystemId.Value; transmitCommandTag += settings.followerSystemId.Value; // Prioritize the given cockpit name rc = GetBlock <IMyShipController>(settings.cockpitName.Value, true); if (rc == null) // Second priority cockpit { rc = GetBlock <IMyCockpit>(); } if (rc == null) // Third priority remote control { rc = GetBlock <IMyRemoteControl>(); } if (rc == null) // No cockpits found. { throw new Exception("No cockpit/remote control found. Set the cockpitName field in settings."); } thrust = new ThrusterControl(rc, settings.tickSpeed.Value, GetBlocks <IMyThrust>()); gyros = new GyroControl(rc, settings.tickSpeed.Value, GetBlocks <IMyGyro>()); if (settings.enableCollisionAvoidence.Value) { cameras = GetBlocks <IMyCameraBlock>(); } if (settings.tickSpeed.Value == UpdateFrequency.Update10) { echoFrequency = 10; } else if (settings.tickSpeed.Value == UpdateFrequency.Update100) { echoFrequency = 1; } leaderListener = IGC.RegisterBroadcastListener(transmitTag); leaderListener.SetMessageCallback(""); commandListener = IGC.RegisterBroadcastListener(transmitCommandTag); commandListener.SetMessageCallback(""); Echo("Ready."); if (!storage.IsDisabled) { Runtime.UpdateFrequency = settings.tickSpeed.Value; } }
void Start() { gridSystem = GridTerminalSystem; gridId = Me.CubeGrid.EntityId; turrets = GetBlocks <IMyLargeTurretBase>(turretGroup, useSubgrids); wcTurrets = new WcPbApi(); try { if (!wcTurrets.Activate(Me)) { wcTurrets = null; } } catch { wcTurrets = null; } if (string.IsNullOrWhiteSpace(rcName)) { rc = GetBlock <IMyRemoteControl>(); } else { rc = GetBlock <IMyRemoteControl>(rcName, useSubgrids); } if (rc == null) { throw new Exception("Remote control block not found."); } gyros = new GyroControl(rc); origin = rc.GetPosition(); this.guns = new List <IMyUserControllableGun>(); List <IMyUserControllableGun> guns = GetBlocks <IMyUserControllableGun>(gunsGroup, useSubgrids); foreach (IMyUserControllableGun g in guns) { if (!(g is IMyLargeTurretBase)) { g.SetValueBool("Shoot", false); if (rocketMode != RocketMode.None) { IMySmallMissileLauncher m = g as IMySmallMissileLauncher; if (m != null) { rockets.Add(m); continue; } } this.guns.Add(g); } } if (receiveHelpMsgs) { helpListener = IGC.RegisterBroadcastListener("AttackDrone_" + commsId); helpListener.SetMessageCallback(""); } thrust = new ThrusterControl(rc, GetBlocks <IMyThrust>(thrustGroup)); maxAngle *= Math.PI / 180; startRuntime = -1; }