GlobalPosToRegionHandle() 공개 정적인 메소드

Given an X/Y location in absolute (grid-relative) terms, a region handle is returned along with the local X/Y location in that region
public static GlobalPosToRegionHandle ( float globalX, float globalY, float &localX, float &localY ) : ulong
globalX float The absolute X location, a number such as /// 255360.35
globalY float The absolute Y location, a number such as /// 255360.35
localX float The sim-local X position of the global X /// position, a value from 0.0 to 256.0
localY float The sim-local Y position of the global Y /// position, a value from 0.0 to 256.0
리턴 ulong
예제 #1
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        public void OnFindAgentReplyHandler(object sender, PacketReceivedEventArgs e)
        {
            if (m_FriendFound != null)
            {
                Packet          packet = e.Packet;
                FindAgentPacket reply  = (FindAgentPacket)packet;

                float x, y;
                UUID  prey         = reply.AgentBlock.Prey;
                ulong regionHandle = Helpers.GlobalPosToRegionHandle((float)reply.LocationBlock[0].GlobalX,
                                                                     (float)reply.LocationBlock[0].GlobalY, out x, out y);
                Vector3 xyz = new Vector3(x, y, 0f);

                OnFriendFoundReply(new FriendFoundReplyEventArgs(prey, regionHandle, xyz));
            }
        }
예제 #2
0
        /// <summary>
        /// Handle friend location updates
        /// </summary>
        /// <param name="packet">The Packet</param>
        /// <param name="simulator">The Simulator</param>
        public void OnFindAgentReplyHandler(Packet packet, Simulator simulator)
        {
            if (OnFriendFound != null)
            {
                FindAgentPacket reply = (FindAgentPacket)packet;

                float x, y;
                UUID  prey         = reply.AgentBlock.Prey;
                ulong regionHandle = Helpers.GlobalPosToRegionHandle((float)reply.LocationBlock[0].GlobalX,
                                                                     (float)reply.LocationBlock[0].GlobalY, out x, out y);
                Vector3 xyz = new Vector3(x, y, 0f);

                try { OnFriendFound(prey, regionHandle, xyz); }
                catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
            }
        }