private void Awake() { Instance = this; SmoothIncrease = _SmoothIncrease; SmoothDecrease = _SmoothDecrease; Slider = GetComponent <Slider>(); Slider.minValue = Min; Slider.maxValue = Max; Slider.value = 200; }
float mouseScroll = 0; //negative down, 0 no change, positive up protected new void Start() { base.Start(); health = maxHealth; hunger = maxHunger; healthBar = GameObject.Find("HealthBar").GetComponent <UiBar>(); hungerBar = GameObject.Find("HungerBar").GetComponent <UiBar>(); hotbar = GameObject.Find("Inventory").GetComponent <UiHotbar>(); hotBarInventory.AddItem(new Tool()); hotBarInventory.AddItem(new Food(5)); hotBarInventory.AddItem(new Food(2)); hotbar.SetInventory(hotBarInventory); hotbar.SetEquiped(equipedItemIndex); }
public void OnClick() { string Position01 = Mathf.Round(gameObject.transform.position.x).ToString(); string Position02 = Mathf.Round(gameObject.transform.position.z).ToString(); int Health; foreach (string Name in GameController.CharacterInGameByName) { if (!(Character.name != Name)) { string CharacterName = Character.name.Replace("Ally-", ""); string CharacterData = FB.MyData[CharacterName]; Health = int.Parse(CharacterData.Substring(0, CharacterData.IndexOf(" "))); FB.MyData[Character.name.Replace("Ally-", "")] = $"{Health} ; {Position01} : {Position02}"; FB.SetValue(); Сlick(); return; } } StartCoroutine(UiBar.Decrease(UiBar.Slider.value - Character.GetComponentInChildren <CharacterController>().Cost)); int Count = 0; foreach (string Name in FB.MyData.Keys) { if (Name.Contains($"Character-{Character.name}")) { Count++; } } Health = Character.GetComponentInChildren <CharacterController>().Health; FB.MyData[$"Character-{Character.name}-0{Count + 1}"] = $"{Health} ; {Position01} : {Position02}"; FB.SetValue(); Сlick(); }