コード例 #1
0
 void OnSerializing(StreamingContext context)
 {
     if (position != null)
     {
         return;
     }
     position = buildingBlock.transform.position.Serialize();
 }
コード例 #2
0
        public override bool Equals(object other)
        {
            if (!(other is SerializedVector3))
            {
                return(false);
            }

            SerializedVector3 v3 = (SerializedVector3)other;

            return(x.Equals(v3.x) && y.Equals(v3.y) && z.Equals(v3.z));
        }
コード例 #3
0
 public StructureComponent(BuildingPart bp, SerializedVector3 v3, SerializedQuaternion q)
 {
     Grade = bp.buildingBlock.grade;
     Prefab = bp.buildingBlock.LookupPrefabName();
     LocalPosition = v3;
     LocalRotation = q;
     Health = (float)((int)Math.Floor((double)(bp.Health / 85)) * 85);
     if (bp.buildingBlock.HasSlot(BaseEntity.Slot.Lock))
     {
         var baseLock = bp.buildingBlock.GetSlot(BaseEntity.Slot.Lock) as BaseLock;
         if (baseLock == null)
         {
             HasCodeLock = false;
             HasKeyLock = false;
         }
         else if (baseLock.GetComponent<CodeLock>())
         {
             HasCodeLock = true;
             HasKeyLock = false;
             CodeLock codeLock = baseLock.GetComponent<CodeLock>();
             if (!string.IsNullOrEmpty((string)codeLock.GetFieldValue("code")))
             {
                 LockCode = (string)codeLock.GetFieldValue("code");
                 LockWList = new List<ulong>();
                 LockWList = (List<ulong>)codeLock.GetFieldValue("whitelistPlayers");
             }
         }
         else if (baseLock.GetComponent<KeyLock>())
         {
             HasCodeLock = false;
             HasKeyLock = true;
             KeyLock keyLock = baseLock.GetComponent<KeyLock>();
             int keyCode = (int)keyLock.GetFieldValue("keyCode");
             keyCode = (bool)keyLock.GetFieldValue("firstKeyCreated") ? keyCode |= 0x80 : (int)keyLock.GetFieldValue("keyCode");
             LockCode = keyCode.ToString();
         }
     }
 }
コード例 #4
0
 public void AddComponent(Deployable deployable)
 {
     if (Origo == null)
     {
         Origo = new Origo(new SerializedVector3(deployable.transform.position), new SerializedQuaternion(deployable.transform.rotation));
     }
     var v3 = new SerializedVector3(deployable.transform.position - Origo.Position.ToVector3());
     var q = new SerializedQuaternion(deployable.transform.rotation);
     var component = new DeployableComponent(deployable, v3, q);
     if (component == null)
     {
         Pluton.Logger.LogDebug("[StructureRecorder] Deployable component is null!");
         return;
     }
     if (!DeployableComponents.ContainsKey(component.ToString()))
     {
         DeployableComponents.Add(component.ToString(), component);
     }
     else
     {
         DeployableComponents[component.ToString()] = component;
     }
 }
コード例 #5
0
 public void AddComponent(BuildingPart bp)
 {
     if (Origo == null)
     {
         Origo = new Origo(new SerializedVector3(bp.Location), new SerializedQuaternion(bp.buildingBlock.transform.rotation));
     }
     var v3 = new SerializedVector3(bp.Location - Origo.Position.ToVector3());
     var q = new SerializedQuaternion(bp.buildingBlock.transform.rotation);
     var component = new StructureComponent(bp, v3, q);
     if (component == null)
     {
         Pluton.Logger.LogDebug("[StructureRecorder] BuildingPart component is null!");
         return;
     }
     if (!StructureComponents.ContainsKey(component.ToString()))
     {
         StructureComponents.Add(component.ToString(), component);
     }
     else
     {
         StructureComponents[component.ToString()] = component;
     }
 }
コード例 #6
0
 public bool Equals(SerializedVector3 v3)
 {
     return(v3.ToVector3().Equals(ToVector3()));
 }
コード例 #7
0
 public StructureComponent(string str, SerializedVector3 v3, SerializedQuaternion q, int i)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
ファイル: BuildingPart.cs プロジェクト: professorlust/Pluton
 void OnSerializing(StreamingContext context)
 {
     position = buildingBlock.transform.position.Serialize();
 }
コード例 #9
0
ファイル: BuildingPart.cs プロジェクト: iScripters/Pluton
 void OnSerializing(StreamingContext context)
 {
     position = buildingBlock.transform.position.Serialize();
 }
コード例 #10
0
 public void RemoveComponent(Spawnable spawnable)
 {
     var v3 = new SerializedVector3(spawnable.transform.position - Origo.Position.ToVector3());
     var q = new SerializedQuaternion(spawnable.transform.rotation);
     var component = new SpawnableComponent(spawnable, v3, q);
     if (SpawnableComponents.ContainsKey(component.ToString()))
     {
         SpawnableComponents.Remove(component.ToString());
     }
 }
コード例 #11
0
 public void RemoveComponent(BuildingPart bp)
 {
     var v3 = new SerializedVector3(bp.Location - Origo.Position.ToVector3());
     var q = new SerializedQuaternion(bp.buildingBlock.transform.rotation);
     var component = new StructureComponent(bp, v3, q);
     if (StructureComponents.ContainsKey(component.ToString()))
     {
         StructureComponents.Remove(component.ToString());
     }
 }
コード例 #12
0
ファイル: BuildingPart.cs プロジェクト: Viproz/Pluton
 void OnSerializing(StreamingContext context)
 {
     if (position != null)
         return;
     position = buildingBlock.transform.position.Serialize();
 }
コード例 #13
0
 public SpawnableComponent(Spawnable spawnable, SerializedVector3 v3, SerializedQuaternion q)
 {
     Prefab = spawnable.GetComponent<BaseNetworkable>().LookupPrefabName();
     LocalPosition = v3;
     LocalRotation = q;
 }
コード例 #14
0
 public Origo(SerializedVector3 v3, SerializedQuaternion q)
 {
     Position = v3;
     Rotation = q;
 }
コード例 #15
0
ファイル: SerializedVector3.cs プロジェクト: Viproz/Pluton
 public bool Equals(SerializedVector3 v3)
 {
     return v3.ToVector3().Equals(ToVector3());
 }