示例#1
0
        public void UpdateGUI()
        {
            ITreeAttribute tree = capi.World.Player.Entity.WatchedAttributes.GetTreeAttribute("health");

            float?currentair = tree.TryGetFloat("currentair");

            if (currentair != null && currentair != statbar.GetValue())
            {
                statbar.SetValue((float)currentair);
            }
        }
        void UpdateBodyheat()
        {
            if (capi.World.Player == null || entity == null)
            {
                return;
            }

            bodyheatBar.SetValue(entity.WatchedAttributes.GetTreeAttribute("bodyheat").GetFloat("currentbodyheat") - 30);

            if (bodyheatBar.GetValue() < 2 || bodyheatBar.GetValue() > 10)
            {
                bodyheatBar.ShouldFlash = true;
            }
            else
            {
                bodyheatBar.ShouldFlash = false;
            }
        }
        void UpdateThirst()
        {
            if (capi.World.Player == null || entity == null)
            {
                return;
            }

            thirstBar.SetValue(entity.WatchedAttributes.GetTreeAttribute("thirst").GetFloat("hydration"));

            if (thirstBar.GetValue() < 300)
            {
                thirstBar.ShouldFlash = true;
            }
            else
            {
                thirstBar.ShouldFlash = false;
            }
        }