Skip to content

Instantly share code, notes, and snippets.

@JonathanYin
Created October 28, 2017 22:53
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 JonathanYin/0effc88412d967d0e997c75a377b7ab1 to your computer and use it in GitHub Desktop.
Save JonathanYin/0effc88412d967d0e997c75a377b7ab1 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class Coin : MonoBehaviour
{
public int scoreValue = 25;
public GameObject player;
public GameObject coin;
void OnTriggerEnter (Collider other)
{
if (other.tag == "Player") {
ScoreManager.score += scoreValue;
Destroy (coin);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment