Created
July 17, 2017 16:20
-
-
Save JonathanYin/c4319733289fed519d6685dece10a04f 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
using UnityEngine; | |
using System.Collections; | |
public class Coins : MonoBehaviour | |
{ | |
//make a container for the heads up display | |
Pancam hud; | |
//public GameObject player; | |
void OnTriggerEnter2D(Collider2D col) | |
{ | |
if (col.tag == "Player1") | |
{ | |
hud = GameObject.Find("Main Camera").GetComponent<Pancam>(); | |
hud.IncreaseScore(30); | |
Destroy(this.gameObject); | |
} | |
else if (col.tag == "Player2") | |
{ | |
hud = GameObject.Find("Main Camera").GetComponent<Pancam>(); | |
hud.IncreaseScore2(30); | |
Destroy(this.gameObject); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this Coin script, I used the same concept as that of my BonusPoints script, but increased the points given to 300.