// Update is called once per frame void Update() { if (path != null) { currentTarget = path.pathPoints[pathIndex].transform; if (Vector3.Distance(currentTarget.transform.position, transform.position) < 0.5f) { pathIndex++; if (pathIndex >= path.pathPoints.Count) { if (path == pathList[0]) { if (leftPath) { path = pathList[1]; } else { path = pathList[2]; } pathIndex = 0; } else { ScenarioManager.Instance().GoToNextScenario(); path = null; } } } } agent.SetDestination(currentTarget.position); }
private void Awake() { ScenarioManager.Instance().StartScenario(); }