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 RemoveComponent(Deployable deployable) { 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 (DeployableComponents.ContainsKey(component.ToString())) { DeployableComponents.Remove(component.ToString()); } }