示例#1
0
        void UpdateRelativeBounds()
        {
            var inputNodes = GetInputNodes();

            if (inputNodes.Count() == 0)
            {
                return;
            }

            BaseNode prevNode    = inputNodes.First();
            BaseNode currentNode = this;

            while (prevNode.GetType() == typeof(NodeBiomeSwitch))
            {
                NodeBiomeSwitch prevSwitch = (NodeBiomeSwitch)prevNode;

                if (prevSwitch.samplerName != samplerName)
                {
                    inputNodes = prevNode.GetInputNodes();

                    if (inputNodes.Count() == 0)
                    {
                        return;
                    }

                    currentNode = prevNode;
                    prevNode    = inputNodes.First();
                    continue;
                }

                var prevNodeOutputAnchors = prevSwitch.outputAnchors.ToList();

                for (int i = 0; i < prevNodeOutputAnchors.Count; i++)
                {
                    var anchor = prevNodeOutputAnchors[i];

                    if (anchor.links.Any(l => l.toNode == currentNode))
                    {
                        relativeMin = prevSwitch.switchList.switchDatas[i].min;
                        relativeMax = prevSwitch.switchList.switchDatas[i].max;
                    }
                }

                break;
            }

            if (prevNode.GetType() != typeof(NodeBiomeSwitch))
            {
                //update currentSampler value:
                if (inputBiome != null)
                {
                    currentSampler = inputBiome.GetSampler(samplerName);
                }

                if (currentSampler == null)
                {
                    return;
                }

                relativeMin = currentSampler.min;
                relativeMax = currentSampler.max;
            }
        }