Hey, i want to set a delay to my script, which loos like this at the moment:
using UnityEngine;
using System.Collections;
using plyBloxKit;
public class NavMeshCheck : MonoBehaviour {
public Transform target;
public GameObject Ampel_Green;
public GameObject Ampel_Red;
public GameObject Attention;
private NavMeshAgent agent;
public bool Path;
public float delay_set = 0.75f;
private float delay = 0.0f;
void Awake() {
Ampel_Red.SetActive(true);
Ampel_Green.SetActive(false);
Attention.SetActive(false);
}
void Update() {
agent = GetComponent<NavMeshAgent>();
NavMeshPath path = new NavMeshPath();
agent.CalculatePath(target.position, path);
if (path.status == NavMeshPathStatus.PathComplete) {
//set delay to the value of delay_set, then count down to 0.0. then do this:
Debug.Log("PathComplete");
Path =true;
Ampel_Green.SetActive(true);
Ampel_Red.SetActive(false);
Attention.SetActive(true);
plyBloxGlobal.Instance.SetVarValue("Puzzle", false);
//GetComponent<Animation>().Play("Ball_Jump");
}
else {
Debug.Log("PathInvalid");
Path =false;
Ampel_Red.SetActive(true);
Ampel_Green.SetActive(false);
plyBloxGlobal.Instance.SetVarValue("Puzzle", true);
Attention.SetActive(false);
}
}
}
as you can see, i have already a float delay and delay_set. and commented already the line where it should appear. could somebody help me with that? thanks!