Skip to content

Instantly share code, notes, and snippets.

@jawinn
Last active July 14, 2016 21:46
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 jawinn/a08ff5206feae934935d0c165b67e2ec to your computer and use it in GitHub Desktop.
Save jawinn/a08ff5206feae934935d0c165b67e2ec to your computer and use it in GitHub Desktop.
MonoBehaviour.Reset() Example
private int _jointHealth;
public int startingJointHealth = 2;
// The setter here helps by making sure our health never goes below zero.
private int JointHealth {
get { return _jointHealth; }
set { _jointHealth = Mathf.Max(value, 0); }
}
void Reset(){
JointHealth = startingJointHealth;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment