private void Awake() { foreach (GameObject carve in carvePoints) { carve.GetComponent <MeshRenderer>().enabled = false; carve.GetComponent <NavMeshObstacle>().enabled = true; } if (curLevel == nextLevel) { carvePoints[curLevel].GetComponent <NavMeshObstacle>().enabled = false; } state = State.Opening; if (!platform.gameObject.activeSelf) { platform.gameObject.SetActive(true); } SetupOffMeshLink(); SetupWaitZone(); for (int i = 0; i < linkPoints.Length; i++) { MeshLinkDetector d = linkPoints[i].GetComponent <MeshLinkDetector>(); d.main = this; d.maxSquadCount = squadCapacity; d.entryLevel = i; } platform.transform.position = levelTransforms[curLevel].transform.position; setupDone = true; }
private void Open() { inWait = linkPoints[nextLevel].GetComponent <MeshLinkDetector>().inWait.Count; if (curLevel != nextLevel) { state = State.Closing; } else if (inWait > 0 && onPlatformList.Count < squadCapacity) { for (int i = 0; i < (squadCapacity - onPlatformList.Count); i++) { MeshLinkDetector detect = linkPoints[curLevel].GetComponent <MeshLinkDetector>(); if (detect.inWait.Count - 1 >= i) { AllowSquadsIn(detect.inWait[i]); } } } else if (onPlatformList.Count == 0 && levelTransforms[curLevel].GetComponentInChildren <MeshLinkDetector>().inWait.Count == 0) { CheckVisitList(); } else if (AllSquadsIsInside(onPlatformList.ToArray(), objOnPlatform.ToArray())) { nextLevel = nextFloorList[0]; } }