Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
avatar
SUPER MODERATOR
SUPER MODERATOR
Posts : 279
Points : 2167
Rep : 58
Join date : 2013-12-16
Age : 17
Location : Boise Idaho United States
View user profile

Supplies Script

on Thu Oct 02, 2014 9:46 pm
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..

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...
Back to top
Permissions in this forum:
You cannot reply to topics in this forum