Hello! Welcome to the Supplies Script...
This script will manage supplies total gathered...and the ammount you need to spawn..
Let's start by doing this:
First make a JavaScript file..
this will allow you to use custom tags and custom everything, this is a base script...
This script will manage supplies total gathered...and the ammount you need to spawn..
Let's start by doing this:
First make a JavaScript file..
Code:
var supint : int;
var supgo : GameObject;
var supplayer : Transform;
var supmax : int;
var customtag : String;
function Start () {
supint = 0;
}
function Update () {
if(supint == supmax && Input.GetKeyDown(KeyCode.F1)) {
Instantiate(supgo, supplayer.position, supplayer.rotation);
}
}
function OnTriggerStay () {
if(supplayer.gameObject.tag == customtag) {
supint++;
Debug.Log("Current int =" + supint);
}
}
this will allow you to use custom tags and custom everything, this is a base script...