protected override void OnSpawn() { base.OnSpawn(); if (conduit == null && bridge == null) { Debug.LogError($"[Pressurized] Pressurized component should not be added unless there is an accomponying Conduit or ConduitBridge component."); } if (!_loadedInfo) { _loadedInfo = true; string id = building.Def.PrefabID; IsBridge = bridge != null; Info = PressurizedTuning.GetPressurizedInfo(id); } if (!Info.IsDefault) { KAnimControllerBase kAnim = this.GetComponent <KAnimControllerBase>(); if (kAnim != null) { kAnim.TintColour = Info.KAnimTint; } else { Debug.LogWarning($"[Pressurized] Conduit.OnSpawn() KAnimControllerBase component was null!"); } } }
private void OnDeserialized() { _loadedInfo = true; string id = building.Def.PrefabID; Info = PressurizedTuning.GetPressurizedInfo(id); }
public static bool TryAddPressurizedInfo(string id, PressurizedInfo info) { if (PressurizedLookup.ContainsKey(id)) { Debug.LogWarning($"[Pressurized] PressurizedTuning.TryAddPressurizedInfo(string, PressurizedInfo) -> Attempted to add an id that already exists."); return(false); } else if (info == null || info.IsDefault == true || info.Capacity <= 0f) { Debug.LogWarning($"[Pressurized] PressurizedTuning.TryAddPressurizedInfo(string, PressurizedInfo) -> PressurizedInfo argument was invalid. Must not be null, have a Capacity > 0, and IsDefault must be false."); return(false); } PressurizedLookup.Add(id, info); return(true); }