AIEditor.EditingLogic.GetNodeOver C# (CSharp) Метод

GetNodeOver() приватный Метод

private GetNodeOver ( ) : PositionedNode
Результат PositionedNode
        private PositionedNode GetNodeOver()
        {
            Cursor cursor = GuiManager.Cursor;

            float worldX;
            float worldY;

            if (EditorData.NodeNetwork.Nodes.Count != 0)
            {
                // While GetVisibleNodeRadius lets us get the radius for any node, for now we'll just
                // assume that all nodes are on the same Z plane.  If this changes later, move the
                // GetVisibleNodeRadius call down into the loop where the nodeRadius variable is used.
                float nodeRadius = EditorData.NodeNetwork.GetVisibleNodeRadius(SpriteManager.Camera, 0);
                
                for(int i = 0; i < EditorData.NodeNetwork.Nodes.Count; i++)
                {
                    PositionedNode node = EditorData.NodeNetwork.Nodes[i];

                    worldX = cursor.WorldXAt(node.Z);
                    worldY = cursor.WorldYAt(node.Z);


                    if ((node.X - worldX) * (node.X - worldX) + (node.Y - worldY) * (node.Y - worldY) < nodeRadius*nodeRadius)
                    {
                        return node;
                    }
                }            
            }
            return null;
        }