Greetings! So i have those two scripts below. One attached to my Floor and the other to my Player. Is there a way to make the screen go gray as soon as the player enter the Trigger and make only the cursor active not the whole mouselook script of the First Person Controller? I tried using Time.timeScale but only the movement was frozen. I could still look around with the mouse. Thanks!
TriggerFloor.js
var showGUI : boolean = false;
var original : Vector3;
var player : GameObject;
function Start(){
player = GameObject.Find("Player");
original = player.transform.position;
}
function OnTriggerEnter(other:Collider){
if(other.gameObject.name == "Player"){
var otherScript = player.GetComponent(FallDamage);
otherScript.hearts -= 1;
showGUI = true;
}
}
function OnGUI(){
if(showGUI){
if(GUI.Button(new Rect(20,70,100,50), "Respawn")){
player.transform.position = original;
showGUI = false;
}
}
}
FallDamage.js
var hearts : int = 3;
function OnGUI(){
GUI.Box(new Rect(20,20,100,40), "Hearts : " + hearts);
if(hearts < 0){
hearts = 0;
Destroy(this.gameObject);
}
}
Someone???
– WesterlyCarrot9