I am trying to make a sneaking game and I cant find a way to increment the variable that tells me if you are detected when you’re in the view of a person/camera/whatever.
For the view of the “detector” I have a cone that I have made a trigger and on my character controller I have a cube that is also a trigger
This is what I have but I’m assuming its horribly wrong, I got it from another question on here.(I’m new to this)
var detect:float;
var incrementTime:float = 0.3;
var incrementBy: float = 1;
var time:double =0;
public function OnTriggerEnter(other: Collider)
{
time+=Time.deltaTime;
while(time>incrementTime)
{
time-=incrementTime;
detect+=incrementBy;
}
}