Beispiel #1
0
 // Token: 0x06001D86 RID: 7558 RVA: 0x00089D5C File Offset: 0x00087F5C
 public bool TestLineOfSight(MapNode other)
 {
     return(!Physics.Linecast(base.transform.position + Vector3.up, other.transform.position + Vector3.up, LayerIndex.world.mask));
 }
Beispiel #2
0
        // Token: 0x06001DD9 RID: 7641 RVA: 0x0007FC08 File Offset: 0x0007DE08
        public void SetNodes(ReadOnlyCollection <MapNode> mapNodes, ReadOnlyCollection <SerializableBitArray> lineOfSightMasks)
        {
            this.Clear();
            Dictionary <MapNode, NodeGraph.NodeIndex> dictionary = new Dictionary <MapNode, NodeGraph.NodeIndex>();
            List <NodeGraph.Node> list  = new List <NodeGraph.Node>();
            List <NodeGraph.Link> list2 = new List <NodeGraph.Link>();

            for (int i = 0; i < mapNodes.Count; i++)
            {
                MapNode key = mapNodes[i];
                dictionary[key] = new NodeGraph.NodeIndex(i);
            }
            for (int j = 0; j < mapNodes.Count; j++)
            {
                MapNode             mapNode    = mapNodes[j];
                NodeGraph.NodeIndex nodeIndexA = dictionary[mapNode];
                int count = list2.Count;
                for (int k = 0; k < mapNode.links.Count; k++)
                {
                    MapNode.Link link = mapNode.links[k];
                    if (!dictionary.ContainsKey(link.nodeB))
                    {
                        Debug.LogErrorFormat(link.nodeB, "[{0}] Node {1} was not registered.", new object[]
                        {
                            k,
                            link.nodeB
                        });
                    }
                    list2.Add(new NodeGraph.Link
                    {
                        nodeIndexA    = nodeIndexA,
                        nodeIndexB    = dictionary[link.nodeB],
                        distanceScore = link.distanceScore,
                        minJumpHeight = link.minJumpHeight,
                        hullMask      = link.hullMask,
                        jumpHullMask  = link.jumpHullMask,
                        gateIndex     = this.RegisterGateName(link.gateName)
                    });
                }
                HullMask hullMask = mapNode.forbiddenHulls;
                for (HullClassification hullClassification = HullClassification.Human; hullClassification < HullClassification.Count; hullClassification++)
                {
                    bool flag = false;
                    int  num  = 1 << (int)hullClassification;
                    List <MapNode.Link> list3 = mapNode.links;
                    for (int l = 0; l < list3.Count; l++)
                    {
                        if ((list3[l].hullMask & num) != 0)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        hullMask |= (HullMask)num;
                    }
                }
                list.Add(new NodeGraph.Node
                {
                    position      = mapNode.transform.position,
                    linkListIndex = new NodeGraph.LinkListIndex
                    {
                        index = count,
                        size  = (uint)mapNode.links.Count
                    },
                    forbiddenHulls  = hullMask,
                    flags           = mapNode.flags,
                    lineOfSightMask = new SerializableBitArray(lineOfSightMasks[j]),
                    gateIndex       = this.RegisterGateName(mapNode.gateName)
                });
            }
            this.nodes = list.ToArray();
            this.links = list2.ToArray();
        }