Files
reedgamingstudio 5b8ebb7a35 test
testing
2014-12-16 00:23:12 -06:00

49 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//NSdesignGames @ 2012
//FPS Kit | Version 2.0
#pragma strict
var guiStyle : GUISkin;
var weaps : GameObject;
var teleportPoint : Transform;
var mm : MainMenu;
private var inside : boolean;
function OnTriggerEnter(weapon : Collider){
//Detect if we on pickable weapon
if(weapon.gameObject.tag == "Player"){
inside = true;
}
}
function OnTriggerExit(weapon : Collider){
if(weapon.gameObject.tag == "Player"){
inside = false;
}
}
function Update(){
if(inside){
if(Input.GetKeyDown(KeyCode.F)){
GameObject.FindWithTag("Player").transform.position = teleportPoint.position;
GameObject.FindWithTag("Player").transform.rotation = teleportPoint.rotation;
inside = false;
weaps.SetActiveRecursively(true);
mm.finishedGame = true;
RenderSettings.fog = false;
Destroy(gameObject);
}
}
}
function OnGUI(){
if(!inside)
return;
GUI.skin = guiStyle;
GUI.color.a = 0.9;
GUI.depth = -10;
var text : String = "Press ´F´ for MORE GUNS! ";
var rect : Rect = Rect (Screen.width/2 - text.Length*9/2,Screen.height/2 - 25,text.Length*9,50);
GUI.Box (rect, text);
}