private void OnFilterChanged(Tag tag) { if (refreshing) { return; } Element element = ElementLoader.GetElement(tag); if (element != null) { filteredElement = element.id; anim.SetSymbolTint("gasframes", element.substance.uiColour); anim.SetSymbolTint("liquid", element.substance.uiColour); anim.SetSymbolTint("liquid_top", element.substance.uiColour); minTemp = element.lowTemp; maxTemp = element.highTemp; Temp = Mathf.Clamp(Temp, element.lowTemp, element.highTemp); } bool invalidElement = (!tag.IsValid || tag == GameTags.Void); selectable.ToggleStatusItem(Db.Get().BuildingStatusItems.NoFilterElementSelected, invalidElement, null); operational.SetFlag(filterFlag, !invalidElement); }
protected virtual void UpdateVisualState(bool force = false) { if (this.wasOn != this.activated || force) { this.wasOn = this.activated; if (this.activated) { animController.Play(ON_ANIMS, KAnim.PlayMode.Loop); int cell = Grid.PosToCell(base.transform.GetPosition()); SolidConduitFlow conduitFlow = GetConduitFlow(); SolidConduitFlow.ConduitContents contents = conduitFlow.GetContents(cell); Pickupable pickupable = conduitFlow.GetPickupable(contents.pickupableHandle); Color32 c = Color.white; if (pickupable.PrimaryElement.DiseaseIdx != 255) { Disease disease = Db.Get().Diseases[(int)pickupable.PrimaryElement.DiseaseIdx]; c = disease.overlayColour; } animController.SetSymbolTint(TINT_SYMBOL, c); } else { animController.Play(OFF_ANIMS, KAnim.PlayMode.Once); } } }
public void SetSymbolTint(KAnimHashedString symbol, Color32 color) { if (variantController == null) { return; } variantController.SetSymbolTint(symbol, color); }
public void Sim33ms(float dt) { if (operational.IsActive && isMovingHeat) { float t = 0.5f + 0.5f * Mathf.Sin(Time.time * Mathf.PI / 2f); Color32 hotGlow = Color32.Lerp(whiteColor, hotColor, t); Color32 coldGlow = Color32.Lerp(coldColor, whiteColor, t); anim.SetSymbolTint("plate", coldGlow); anim.SetSymbolTint("fins", hotGlow); } else { anim.SetSymbolTint("plate", whiteColor); anim.SetSymbolTint("fins", whiteColor); } }
private void UpdateVisualState(bool force = false) { if (wasOn != switchedOn || force) { wasOn = switchedOn; if (switchedOn) { animController.Play(ON_ANIMS, KAnim.PlayMode.Loop); int i = Grid.PosToCell(this); byte b = Grid.DiseaseIdx[i]; Color32 c = Color.white; if (b != 255) { Disease disease = Db.Get().Diseases[b]; c = disease.overlayColour; } animController.SetSymbolTint(TINT_SYMBOL, c); } else { animController.Play(OFF_ANIMS, KAnim.PlayMode.Once); } } }