hey guys i got this script for my shield it works But!! it stays to long in face when hit i tryed to set the timer to 0,1 that its vissible for 0,1 second when hit and it seems to only react to a rigidbody projectile beecouse i can shoot it with my mashine gun and nothing happens and when i shoot it with my rocked louncher it becomes vissible but as i sayd al reddey it shows to long. how can i fix this??or can you?
var Shot : boolean = false;
var Timer : float;
function Update () {
//Normaly it's not showen
renderer.enabled = false;
if (Shot) {
//The time wich defines how long the sphere is showen
Timer += Time.deltaTime;
//If You make 0.1 its shorter showen if you make 2 it's longer showen
if (Timer < 1) {
renderer.enabled = true;
}
//If the time runs out it's dosen't showen
else {
renderer.enabled = false;
Shot = false;
}
}
// Reset the Timer
else {
Timer = 0;
}
}
// This change Shot if something touches the Forcefield
function OnTriggerEnter () {
Shot = true;
}