protected override void Update() { base.Update(); PlayerCharacter character = GetPlayer(); int gold = (character != null) ? character.Data.gold : 0; if (gold_value != null) { gold_value.text = gold.ToString(); } //Init inventories from here because they are disabled foreach (ItemSlotPanel panel in item_slot_panels) { panel.InitPanel(); } //Fx visibility damage_fx_timer += Time.deltaTime; if (build_mode_text != null) { build_mode_text.enabled = IsBuildMode(); } if (tps_cursor != null) { tps_cursor.enabled = TheCamera.Get().IsLocked(); } if (character != null && !character.IsDead() && character.Attributes.IsDepletingHP()) { DoDamageFXInterval(); } //Cold FX if (character != null && !character.IsDead()) { PlayerCharacterHeat characterHeat = PlayerCharacterHeat.Get(character.player_id); if (cold_fx != null && characterHeat != null) { cold_fx.SetVisible(characterHeat.IsCold()); } if (damage_fx != null && characterHeat != null && characterHeat.IsColdDamage()) { DoDamageFXInterval(); } } //Controls PlayerControls controls = PlayerControls.Get(player_id); if (controls.IsPressCraft()) { CraftPanel.Get(player_id)?.Toggle(); ActionSelectorUI.Get(player_id)?.Hide(); ActionSelector.Get(player_id)?.Hide(); } //Backpack panel BagPanel bag_panel = BagPanel.Get(player_id); if (character != null && bag_panel != null) { InventoryItemData item = character.Inventory.GetBestEquippedBag(); ItemData idata = ItemData.Get(item?.item_id); if (idata != null) { bag_panel.ShowBag(character, item.uid, idata.bag_size); } else { bag_panel.HideBag(); } } }