// Token: 0x060005F9 RID: 1529 RVA: 0x000189B4 File Offset: 0x00016BB4
        private void GeneratePlayerSpawnPointsServer()
        {
            if (this.nullWards.Length == 0)
            {
                return;
            }
            Vector3         position        = this.nullWards[0].transform.position;
            NodeGraph       groundNodes     = SceneInfo.instance.groundNodes;
            NodeGraphSpider nodeGraphSpider = new NodeGraphSpider(SceneInfo.instance.groundNodes, HullMask.Human);

            nodeGraphSpider.AddNodeForNextStep(groundNodes.FindClosestNode(position, HullClassification.Human));
            for (int i = 0; i < 4; i++)
            {
                nodeGraphSpider.PerformStep();
                if (nodeGraphSpider.collectedSteps.Count > 16)
                {
                    break;
                }
            }
            for (int j = 0; j < nodeGraphSpider.collectedSteps.Count; j++)
            {
                NodeGraphSpider.StepInfo stepInfo = nodeGraphSpider.collectedSteps[j];
                SpawnPoint.AddSpawnPoint(groundNodes, stepInfo.node, this.rng);
            }
        }
Beispiel #2
0
        // Token: 0x06000DB9 RID: 3513 RVA: 0x000435A4 File Offset: 0x000417A4
        private void GenerateAmbush(Vector3 victimPosition)
        {
            NodeGraph groundNodes = SceneInfo.instance.groundNodes;

            NodeGraph.NodeIndex nodeIndex       = groundNodes.FindClosestNode(victimPosition, HullClassification.Human);
            NodeGraphSpider     nodeGraphSpider = new NodeGraphSpider(groundNodes, HullMask.Human);

            nodeGraphSpider.AddNodeForNextStep(nodeIndex);
            List <NodeGraphSpider.StepInfo> list = new List <NodeGraphSpider.StepInfo>();
            int num = 0;
            List <NodeGraphSpider.StepInfo> collectedSteps = nodeGraphSpider.collectedSteps;

            while (nodeGraphSpider.PerformStep() && num < 8)
            {
                num++;
                for (int i = 0; i < collectedSteps.Count; i++)
                {
                    if (CombatDirector.IsAcceptableAmbushSpiderStep(groundNodes, nodeIndex, collectedSteps[i]))
                    {
                        list.Add(collectedSteps[i]);
                    }
                }
                collectedSteps.Clear();
            }
            for (int j = 0; j < list.Count; j++)
            {
                Vector3 position;
                groundNodes.GetNodePosition(list[j].node, out position);
                Resources.Load <SpawnCard>("SpawnCards/scLemurian").DoSpawn(position, Quaternion.identity);
            }
        }
 // Token: 0x0600097C RID: 2428 RVA: 0x0002FBD8 File Offset: 0x0002DDD8
 public override void OnEnter()
 {
     base.OnEnter();
     if (base.ai && base.body)
     {
         this.targetPosition = base.bodyTransform.position;
         NodeGraph       nodeGraph       = base.ai.GetNodeGraph();
         NodeGraphSpider nodeGraphSpider = new NodeGraphSpider(nodeGraph, (HullMask)(1 << (int)base.body.hullClassification));
         nodeGraphSpider.AddNodeForNextStep(nodeGraph.FindClosestNode(base.bodyTransform.position, base.body.hullClassification));
         for (int i = 0; i < 6; i++)
         {
             nodeGraphSpider.PerformStep();
         }
         List <NodeGraphSpider.StepInfo> collectedSteps = nodeGraphSpider.collectedSteps;
         if (collectedSteps.Count > 0)
         {
             int index = UnityEngine.Random.Range(0, collectedSteps.Count);
             NodeGraph.NodeIndex node = collectedSteps[index].node;
             nodeGraph.GetNodePosition(node, out this.targetPosition);
             base.ai.pathFollower.targetPosition = this.targetPosition;
         }
         this.PickNewTargetLookPosition();
     }
 }
        // 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);
            }
        }
Beispiel #5
0
        // 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);
            }
        }