コード例 #1
0
ファイル: MTSyncGame.cs プロジェクト: CaptainPMM/AdmiralWW2
 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];
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
        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;
        }
コード例 #4
0
ファイル: GameManager.cs プロジェクト: CaptainPMM/AdmiralWW2
    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");
        }
    }
コード例 #5
0
 private Toggle GetToggleByChadburn(Autopilot.ChadburnSetting chadburn)
 {
     return(toggleChadburnSettingAssocs.Find(tcs => tcs.chadburnSetting == chadburn).toggle);
 }
コード例 #6
0
        private IEnumerator DelayedChadburnSelectorSetter(Autopilot.ChadburnSetting chadburnSetting)
        {
            yield return(new WaitForEndOfFrame());

            GetToggleByChadburn(chadburnSetting).isOn = true;
        }
コード例 #7
0
 public void Read(Reader reader)
 {
     PlayerTag       = reader.ReadEnum <PlayerTag>();
     ShipID          = new ID(reader.ReadString());
     ChadburnSetting = reader.ReadEnum <Autopilot.ChadburnSetting>();
 }