private void AllocateShipArrays() { ShipIDs = new ID[NumShips]; ShipPositions = new Vector3[NumShips]; ShipRotations = new Vector3[NumShips]; ShipVelocities = new Vector3[NumShips]; ShipsHitpoints = new float[NumShips]; ShipsNumWaterIngressSections = new byte[NumShips]; WaterIngressSectionsIDs = new byte[SumWaterIngressSections]; WaterIngressNumHoles = new int[SumWaterIngressSections]; WaterIngressWaterLevels = new float[SumWaterIngressSections]; ShipChadburnSettings = new Autopilot.ChadburnSetting[NumShips]; ShipCourses = new ushort[NumShips]; ShipsHasTarget = new bool[NumShips]; ShipsTargetShipID = new ID[NumShips]; ShipsNumGunTurrets = new byte[NumShips]; GunTurretIDs = new ID[SumGunTurrets]; GunTurretsDisabled = new bool[SumGunTurrets]; GunTurretsReloadProgress = new float[SumGunTurrets]; GunTurretsRotation = new float[SumGunTurrets]; GunTurretsTargetRotation = new float[SumGunTurrets]; GunTurretsElevation = new float[SumGunTurrets]; GunTurretsTargetElevation = new float[SumGunTurrets]; GunTurretsStabilizationAngle = new float[SumGunTurrets]; ShipNumDamageZones = new byte[NumShips]; ShipDamageZoneIDs = new ID[SumDamageZones]; DamageZoneNumDamages = new byte[SumDamageZones]; DamageZoneDamages = new DamageType[SumDamageZoneDamages]; }
public void OnToggleChange(bool isOn) { if (isOn) { Autopilot.ChadburnSetting chad = GetChadburnByToggle(toggleGroup.GetFirstActiveToggle()); if (P2PManager.IsMPActive()) { P2PManager.Inst.Send(new MTShipChadburn { PlayerTag = GameManager.ThisPlayerTag, ShipID = InputManager.SelectedShip.ID, ChadburnSetting = chad }); } InputManager.SelectedShip.Autopilot.Chadburn = chad; } }
public override void OnInspectorGUI() { Autopilot a = (Autopilot)target; if (DrawDefaultInspector()) { if (a.Chadburn != lastChadburn) { a.Chadburn = a.Chadburn; // Triggers the property setter } } lastChadburn = a.Chadburn; }
public void SetShipChadburn(PlayerTag playerTag, ID shipID, Autopilot.ChadburnSetting chadburnSetting) { PlayerFleet fleet = fleets.Find(f => f.PlayerTag == playerTag); if (fleet != null) { Ship ship = fleet.Ships.Find(s => s.ID == shipID); if (ship != null) { ship.Autopilot.Chadburn = chadburnSetting; } else { Debug.LogWarning("Ship with ID " + shipID + " not found"); } } else { Debug.LogWarning("Fleet of player tag " + playerTag + " not found"); } }
private Toggle GetToggleByChadburn(Autopilot.ChadburnSetting chadburn) { return(toggleChadburnSettingAssocs.Find(tcs => tcs.chadburnSetting == chadburn).toggle); }
private IEnumerator DelayedChadburnSelectorSetter(Autopilot.ChadburnSetting chadburnSetting) { yield return(new WaitForEndOfFrame()); GetToggleByChadburn(chadburnSetting).isOn = true; }
public void Read(Reader reader) { PlayerTag = reader.ReadEnum <PlayerTag>(); ShipID = new ID(reader.ReadString()); ChadburnSetting = reader.ReadEnum <Autopilot.ChadburnSetting>(); }