var score = 0.0;
var healthPickup = 25;
var health = 100;
var superPickup = 25 ;
@script ExecuteInEditMode()
var screenXAxis = 50;
var screenYAxis = 50;
var screenWidth = 100;
var screenLength = 100;
function OnGUI()
{
GUI.Box(Rect(screenXAxis,screenYAxis,screenWidth,screenLength),"Score: " + score );
}
function OnCollisionEnter(other : Collision)
{
if (other.gameObject.tag == "Pickup")
{
score+=5;
Destroy (other.gameObject);
if(other.gameObject.tag == "SuperPickup")
{
score+=25;
Destroy (other.gameObject);
}
}
}
My code will pickup the first pickup but wont pickup superpickup it just runs into it