コード例 #1
0
        public override bool Equals(object other)
        {
            if (!(other is SerializedQuaternion))
            {
                return(false);
            }
            SerializedQuaternion q = (SerializedQuaternion)other;

            return(x.Equals(q.x) && y.Equals(q.y) && z.Equals(q.z) && w.Equals(q.w));
        }
コード例 #2
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();
         }
     }
 }
コード例 #3
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;
     }
 }
コード例 #4
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;
     }
 }
コード例 #5
0
 public StructureComponent(string str, SerializedVector3 v3, SerializedQuaternion q, int i)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
 public bool Equals(SerializedQuaternion q)
 {
     return(q.ToQuaternion().Equals(ToQuaternion()));
 }
コード例 #7
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());
     }
 }
コード例 #8
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());
     }
 }
コード例 #9
0
 public SpawnableComponent(Spawnable spawnable, SerializedVector3 v3, SerializedQuaternion q)
 {
     Prefab = spawnable.GetComponent<BaseNetworkable>().LookupPrefabName();
     LocalPosition = v3;
     LocalRotation = q;
 }
コード例 #10
0
 public Origo(SerializedVector3 v3, SerializedQuaternion q)
 {
     Position = v3;
     Rotation = q;
 }
コード例 #11
0
ファイル: SerializedQuaternion.cs プロジェクト: Viproz/Pluton
 public bool Equals(SerializedQuaternion q)
 {
     return q.ToQuaternion().Equals(ToQuaternion());
 }