private void OnTriggerEnter(Collider other) { if (other.tag == "NodeTrigger") { if (other.GetComponent <AINode>().NextNodeInPath == null) { pathFollowState = PathFollowState.GoToPreviousNode; } if (other.GetComponent <AINode>().PreviousNodeInPath == null) { pathFollowState = PathFollowState.GoToNextNode; } switch (pathFollowState) { case PathFollowState.GoToNextNode: nodeToMoveTowards = other.GetComponent <AINode>().NextNodeInPath; break; case PathFollowState.GoToPreviousNode: nodeToMoveTowards = other.GetComponent <AINode>().PreviousNodeInPath; break; default: break; } } }
private PathFollowState() { if (_instance != null) { return; } _instance = this; }