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; } }
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; } }
public void AddComponent(Spawnable spawnable) { if (Origo == null) { Origo = new Origo(new SerializedVector3(spawnable.transform.position), new SerializedQuaternion(spawnable.transform.rotation)); } 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 (component == null) { Pluton.Logger.LogDebug("[StructureRecorder] Deployable component is null!"); return; } if (!SpawnableComponents.ContainsKey(component.ToString())) { SpawnableComponents.Add(component.ToString(), component); } else { SpawnableComponents[component.ToString()] = component; } }