Skip to content

Instantly share code, notes, and snippets.

@kihira
Created November 24, 2015 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kihira/d11a4128ea96cdf3b76f to your computer and use it in GitHub Desktop.
Save kihira/d11a4128ea96cdf3b76f to your computer and use it in GitHub Desktop.
public GameObject multiplier;
private float multiScaleRate = 0.005f;
private int currentMult = 1;
void Update ()
{
// Check size of multiplier object and reduce it if required
if (multiplier.transform.localScale.x > 1)
{
multiplier.transform.localScale = new Vector3(multiplier.transform.localScale.x - (multiScaleRate * Time.timeScale), multiplier.transform.localScale.y - (multiScaleRate * Time.timeScale));
}
}
private void SetMultiplyer(int mult)
{
// Don't do anything if multiplyer hasn't changed
if (mult == currentMult)
{
return;
}
currentMult = mult;
multiplier.GetComponent<Text>().text = mult + "x";
multiplier.transform.localScale = new Vector3(1.5f, 1.5f, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment