private void EvaluateLane() { CurrentIndex++; // index can equal laneData.Count so it can finish npc move IE if (CurrentIndex < LaneData.Count) { CurrentTarget = LaneData[CurrentIndex]; } if (CurrentIndex == LaneData.Count) { if (WaypointLoop) { rb.MovePosition(InitPos); rb.MoveRotation(InitRot); InitNPC(); } else { WaypointState = WaypointDriveState.Despawn; FixedUpdateManager.StopAllCoroutines(); TriggerCoroutine = null; IdleCoroutine = null; MoveCoroutine = null; } } else { WaypointState = WaypointDriveState.Drive; } }
private void InitNPC() { Debug.Assert(LaneData != null); rb.isKinematic = true; controller.MainCollider.isTrigger = true; controller.ResetLights(); currentSpeed = 0f; rb.angularVelocity = Vector3.zero; rb.velocity = Vector3.zero; CurrentIndex = 0; CurrentDeactivate = LaneDeactivate[CurrentIndex]; FixedUpdateManager.StopAllCoroutines(); TriggerCoroutine = null; IdleCoroutine = null; MoveCoroutine = null; WaypointState = WaypointDriveState.Drive; }
private void EvaluateLane() { CurrentIndex++; // index can equal laneData.Count so it can finish npc move IE if (CurrentIndex < LaneData.Count) { CurrentTarget = LaneData[CurrentIndex]; controller.MovementSpeed = LaneSpeed[CurrentIndex]; } if (CurrentIndex == LaneData.Count) { var api = ApiManager.Instance; if (WaypointLoop) { if (CurrentLoopIndex == 0 && api != null) { api.AgentTraversedWaypoints(gameObject); } CurrentLoopIndex++; rb.MovePosition(InitPos); rb.MoveRotation(InitRot); InitNPC(); } else { if (api != null) { api.AgentTraversedWaypoints(gameObject); } WaypointState = WaypointDriveState.Despawn; FixedUpdateManager.StopAllCoroutines(); TriggerCoroutine = null; IdleCoroutine = null; MoveCoroutine = null; } } else { WaypointState = WaypointDriveState.Drive; } }