Hey everyone,
so I’ve got the basic “collect items for points” script below, and want to add an animation when the player hits the trigger. The animation is attached to the MainCamera object (and must be, as it modifies an ImageEffect), and I want to cue it from this script.
Script:
var score = 0;
var scoreText = "Score: 0";
var MyFont : Font;
function OnTriggerEnter( other : Collider ) {
Debug.Log("OnTriggerEnter() was called");
if (other.tag == "Coin") {
Debug.Log("Other object is a coin");
score += 5;
scoreText = "Score: " + score;
Debug.Log("Score is now " + score);
yield WaitForSeconds (.2);
Destroy(other.gameObject);
}
}
function OnGUI () {
GUI.skin.font = MyFont;
GUI.color = Color.black;
GUI.Label (Rect (10, 10, 500, 300), scoreText);
}
It’s javascript, and I’ve tried a few options, but they seemed to mostly be in C#. Thanks for the help!
Pat