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()); } }
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; } }