-
-
Save kihira/d11a4128ea96cdf3b76f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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