Skip to content

Instantly share code, notes, and snippets.

@moon-goon
Created February 9, 2016 03:22
Show Gist options
  • Save moon-goon/a0b18d35cd65fa1f0078 to your computer and use it in GitHub Desktop.
Save moon-goon/a0b18d35cd65fa1f0078 to your computer and use it in GitHub Desktop.
score_manager myScoreManager;
void Start() {
myScoreManager = GetComponent<score_manager>();
}
void OnCollisionEnter(Collision target) {
if (target.gameObject.name == "dragon") {
onHit();
myScoreManager.addScore(50);
}
if (target.gameObject.tag == "potion" ) {
Destroy(target.gameObject);
myScoreManager.addScore(20);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment