// Update is called once per frame void Update() { if (active) { if (Controls.Shake) { Camera.main.transform.Shake(0.5f, 3); Flytext.CreateFlytext(Vector3.up, score.ToString("#"), Color.white, 6, 1.5f, 1); GameObject.FindObjectOfType <FillBar>().UpdateValue(100 * (Random.value - 0.6f)); } if (Controls.Pause) { Pause(); } Score += Time.deltaTime * Random.value * 100; } }
public void UpdateValue(float change) { if (flytext) { if (change < 0) { Flytext.CreateFlytext(transform.position + Vector3.up * 0.2f, change.ToString("#"), flytextDown, flytextSize); } else { Flytext.CreateFlytext(transform.position + Vector3.up * 0.2f, change.ToString("#"), flytextUp, flytextSize); } } currentValue += change; currentValue = Mathf.Clamp(currentValue, 0, fullValue); Percent += change / fullValue; }