Beispiel #1
0
 public void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo)
 {
     var packedValue = reader.ReadUInt16();
     Weapon1 = (ShipDevice.FiringResult)(packedValue & 0x07);
     if (!Enum.IsDefined(typeof(ShipDevice.FiringResult), Weapon1)) Weapon1 = ShipDevice.FiringResult.Void;
     Weapon2 = (ShipDevice.FiringResult)((packedValue >> 4) & 0x07);
     if (!Enum.IsDefined(typeof(ShipDevice.FiringResult), Weapon2)) Weapon2 = ShipDevice.FiringResult.Void;
     ExtraDevice = (ShipDevice.FiringResult)((packedValue >> 8) & 0x07);
     if (!Enum.IsDefined(typeof(ShipDevice.FiringResult), ExtraDevice)) ExtraDevice = ShipDevice.FiringResult.Void;
 }
Beispiel #2
0
 public ShipDevice.FiringResult this[ShipDevice.OwnerHandleType ownerHandleType]
 {
     get
     {
         switch (ownerHandleType)
         {
             case ShipDevice.OwnerHandleType.PrimaryWeapon: return Weapon1;
             case ShipDevice.OwnerHandleType.SecondaryWeapon: return Weapon2;
             case ShipDevice.OwnerHandleType.ExtraDevice: return ExtraDevice;
             default: throw new ApplicationException("Invalid owner handle " + ownerHandleType);
         }
     }
     set
     {
         switch (ownerHandleType)
         {
             case ShipDevice.OwnerHandleType.PrimaryWeapon: Weapon1 = Merge(Weapon1, value); break;
             case ShipDevice.OwnerHandleType.SecondaryWeapon: Weapon2 = Merge(Weapon2, value); break;
             case ShipDevice.OwnerHandleType.ExtraDevice: ExtraDevice = Merge(ExtraDevice, value); break;
             default: throw new ApplicationException("Invalid owner handle " + ownerHandleType);
         }
     }
 }
Beispiel #3
0
 public void Clear()
 {
     Weapon1 = ShipDevice.FiringResult.Void;
     Weapon2 = ShipDevice.FiringResult.Void;
     ExtraDevice = ShipDevice.FiringResult.Void;
 }