// Token: 0x06001290 RID: 4752 RVA: 0x0004FBC8 File Offset: 0x0004DDC8 private void PlacePlayerSpawnsViaNodegraph() { bool usePod = Stage.instance.usePod; NodeGraph groundNodes = SceneInfo.instance.groundNodes; NodeFlags requiredFlags = NodeFlags.None; NodeFlags nodeFlags = NodeFlags.None; nodeFlags |= NodeFlags.NoCharacterSpawn; List <NodeGraph.NodeIndex> activeNodesForHullMaskWithFlagConditions = groundNodes.GetActiveNodesForHullMaskWithFlagConditions(HullMask.Golem, requiredFlags, nodeFlags); if (usePod) { int num = activeNodesForHullMaskWithFlagConditions.Count - 1; while (num >= 0 && activeNodesForHullMaskWithFlagConditions.Count > 1) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, activeNodesForHullMaskWithFlagConditions[num])) { activeNodesForHullMaskWithFlagConditions.RemoveAt(num); } num--; } } NodeGraph.NodeIndex nodeIndex; if (this.teleporterInstance) { Vector3 position = this.teleporterInstance.transform.position; List <SceneDirector.NodeDistanceSqrPair> list = new List <SceneDirector.NodeDistanceSqrPair>(); for (int i = 0; i < activeNodesForHullMaskWithFlagConditions.Count; i++) { Vector3 b2; groundNodes.GetNodePosition(activeNodesForHullMaskWithFlagConditions[i], out b2); list.Add(new SceneDirector.NodeDistanceSqrPair { nodeIndex = activeNodesForHullMaskWithFlagConditions[i], distanceSqr = (position - b2).sqrMagnitude }); } list.Sort((SceneDirector.NodeDistanceSqrPair a, SceneDirector.NodeDistanceSqrPair b) => a.distanceSqr.CompareTo(b.distanceSqr)); int index = this.rng.RangeInt(list.Count * 3 / 4, list.Count); nodeIndex = list[index].nodeIndex; } else { nodeIndex = this.rng.NextElementUniform <NodeGraph.NodeIndex>(activeNodesForHullMaskWithFlagConditions); } NodeGraphSpider nodeGraphSpider = new NodeGraphSpider(groundNodes, HullMask.Human); nodeGraphSpider.AddNodeForNextStep(nodeIndex); while (nodeGraphSpider.PerformStep()) { List <NodeGraphSpider.StepInfo> collectedSteps = nodeGraphSpider.collectedSteps; if (usePod) { for (int j = collectedSteps.Count - 1; j >= 0; j--) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, collectedSteps[j].node)) { collectedSteps.RemoveAt(j); } } } if (collectedSteps.Count >= RoR2Application.maxPlayers) { break; } } List <NodeGraphSpider.StepInfo> collectedSteps2 = nodeGraphSpider.collectedSteps; Util.ShuffleList <NodeGraphSpider.StepInfo>(collectedSteps2, Run.instance.stageRng); int num2 = Math.Min(nodeGraphSpider.collectedSteps.Count, RoR2Application.maxPlayers); for (int k = 0; k < num2; k++) { SpawnPoint.AddSpawnPoint(groundNodes, collectedSteps2[k].node, this.rng); } }
// Token: 0x0600150E RID: 5390 RVA: 0x00064F0C File Offset: 0x0006310C private void PlacePlayerSpawnsViaNodegraph() { bool usePod = Stage.instance.usePod; NodeGraph groundNodes = SceneInfo.instance.groundNodes; List <NodeGraph.NodeIndex> activeNodesForHullMask = groundNodes.GetActiveNodesForHullMask(HullMask.Golem); if (usePod) { for (int i = activeNodesForHullMask.Count - 1; i >= 0; i--) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, activeNodesForHullMask[i])) { activeNodesForHullMask.RemoveAt(i); } } } NodeGraph.NodeIndex nodeIndex; if (this.teleporterInstance) { Vector3 position = this.teleporterInstance.transform.position; List <SceneDirector.NodeDistanceSqrPair> list = new List <SceneDirector.NodeDistanceSqrPair>(); for (int j = 0; j < activeNodesForHullMask.Count; j++) { Vector3 b2; groundNodes.GetNodePosition(activeNodesForHullMask[j], out b2); list.Add(new SceneDirector.NodeDistanceSqrPair { nodeIndex = activeNodesForHullMask[j], distanceSqr = (position - b2).sqrMagnitude }); } list.Sort((SceneDirector.NodeDistanceSqrPair a, SceneDirector.NodeDistanceSqrPair b) => a.distanceSqr.CompareTo(b.distanceSqr)); int index = this.rng.RangeInt(list.Count * 3 / 4, list.Count); nodeIndex = list[index].nodeIndex; } else { nodeIndex = activeNodesForHullMask[this.rng.RangeInt(0, activeNodesForHullMask.Count)]; } NodeGraphSpider nodeGraphSpider = new NodeGraphSpider(groundNodes, HullMask.Human); nodeGraphSpider.AddNodeForNextStep(nodeIndex); while (nodeGraphSpider.PerformStep()) { List <NodeGraphSpider.StepInfo> collectedSteps = nodeGraphSpider.collectedSteps; if (usePod) { for (int k = collectedSteps.Count - 1; k >= 0; k--) { if (!SceneDirector.IsNodeSuitableForPod(groundNodes, collectedSteps[k].node)) { collectedSteps.RemoveAt(k); } } } if (collectedSteps.Count >= RoR2Application.maxPlayers) { break; } } List <NodeGraphSpider.StepInfo> collectedSteps2 = nodeGraphSpider.collectedSteps; Util.ShuffleList <NodeGraphSpider.StepInfo>(collectedSteps2, Run.instance.stageRng); int num = Math.Min(nodeGraphSpider.collectedSteps.Count, RoR2Application.maxPlayers); for (int l = 0; l < num; l++) { NodeGraph.NodeIndex node = collectedSteps2[l].node; Vector3 vector; groundNodes.GetNodePosition(node, out vector); NodeGraph.LinkIndex[] activeNodeLinks = groundNodes.GetActiveNodeLinks(node); Quaternion rotation; if (activeNodeLinks.Length != 0) { int num2 = this.rng.RangeInt(0, activeNodeLinks.Length); NodeGraph.LinkIndex linkIndex = activeNodeLinks[num2]; Vector3 a2; groundNodes.GetNodePosition(groundNodes.GetLinkEndNode(linkIndex), out a2); rotation = Util.QuaternionSafeLookRotation(a2 - vector); } else { rotation = Quaternion.Euler(0f, this.rng.nextNormalizedFloat * 360f, 0f); } UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/SpawnPoint"), vector, rotation); } }