public void SetRegenSpeed(InteractableColor type, float newRegen) { switch (type) { case InteractableColor.RED: { PlayerUI.instance.redSlider.regenSpeed = newRegen; break; } case InteractableColor.BLUE: { PlayerUI.instance.blueSlider.regenSpeed = newRegen; break; } case InteractableColor.GREEN: { PlayerUI.instance.greenSlider.regenSpeed = newRegen; break; } default: { Debug.LogWarning("Tried to set regen speed on null value!"); break; } } }
public void UpdatePlayerAbilities(InteractableColor color) { UpdatePlayerSpeedAndJump(); SetRegenSpeed(InteractableColor.GREEN, GameManager.instance.GreenStatMax / 5f); SetRegenSpeed(InteractableColor.RED, GameManager.instance.RedStatMax / 5f); SetRegenSpeed(InteractableColor.BLUE, GameManager.instance.BlueStatMax / 5f); }
public float GetStatMax(InteractableColor type) { switch (type) { case InteractableColor.BLUE: { return(BlueStatMax); } case InteractableColor.RED: { return(RedStatMax); } case InteractableColor.GREEN: { return(GreenStatMax); } default: { Debug.LogWarning("Did not assign any stat type to raise!"); return(0f); } } }
public void AddStat(InteractableColor type, float amount) { switch (type) { case InteractableColor.BLUE: { BlueStatMax += Mathf.Clamp(amount, 1f, 100f); statUpdateEvent.Invoke(InteractableColor.BLUE); break; } case InteractableColor.RED: { RedStatMax += Mathf.Clamp(amount, 1f, 100f); statUpdateEvent.Invoke(InteractableColor.RED); break; } case InteractableColor.GREEN: { GreenStatMax += Mathf.Clamp(amount, 1f, 100f); statUpdateEvent.Invoke(InteractableColor.GREEN); break; } default: { Debug.LogWarning("Did not assign any stat type to raise!"); break; } } PlayerUI.instance.UpdateSliders(); audioSource.SetClip(gainStatSound, false); audioSource.Play(); }
void UpdateSelf(InteractableColor updateColor) { //Debug.Log ("Received update for " + updateColor + " for slider " + color); if (color == updateColor) { maxValue = GameManager.instance.GetStatMax(color); Mathf.Clamp(value, 0f, maxValue); } }
public void UpdateSliders(InteractableColor type) // Listens to game manager events on updates { redSlider.maxValue = GameManager.instance.RedStatMax; greenSlider.maxValue = GameManager.instance.GreenStatMax; blueSlider.maxValue = GameManager.instance.BlueStatMax; }