Skip to content

Instantly share code, notes, and snippets.

@poemdexter
Last active August 29, 2015 13:55
Show Gist options
  • Save poemdexter/8701919 to your computer and use it in GitHub Desktop.
Save poemdexter/8701919 to your computer and use it in GitHub Desktop.
ping pong dongs
// POWvalue is current value of potential score
// POWProgress.value is current position of POW bar
void Increment()
{
we initiate a new float every Increment() that will hold new value of the POWProgress.value as it pingpongs
POWProgress.value = Mathf.PingPong(Time.deltaTime, 1);
}
int Calculate()
{
int scoreValue = Mathf.CeilToInt(POWProgress.value * 100);
Debug.Log("POW: " + scoreValue);
return scoreValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment