Created
July 17, 2017 16:20
-
-
Save JonathanYin/605cc256e1e90189c1c53827960db1bd 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 BonusPoints : 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(10); | |
Destroy(this.gameObject); | |
} | |
else if (col.tag == "Player2") | |
{ | |
hud = GameObject.Find("Main Camera").GetComponent<Pancam>(); | |
hud.IncreaseScore2(10); | |
Destroy(this.gameObject); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script creates a bonus-point pickup, and when a player collides with it and collects it, it will grant them 100 bonus points.