Ejemplo n.º 1
0
        public static void SendActorLocationChange(Vector3 vNewPos)
        {
            UActorLocationChangeMsgData msgData = new UActorLocationChangeMsgData();

            msgData.msgID   = (int)WndMsgID.WND_MSG_COMMON_LOCATION_CHANGE;
            msgData.vNewPos = vNewPos;
            UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_COMMON_LOCATION_CHANGE, msgData);
        }
Ejemplo n.º 2
0
        public void onActorLocationChange(UActorLocationChangeMsgData msgData)
        {
            if (!m_wnd.IsVisible())
            {
                return;
            }

            if (msgData == null)
            {
                return;
            }

            if (m_CurNPCUID <= 0)
            {
                return;
            }

            // 获取NPC位置
            entity_location location = new entity_location();

            if (!GameLogicAPI.GetEntityLocation((int)m_CurNPCUID, ref location))
            {
                return;
            }
            Vector3 NPCPosition = new Vector3(location.x, location.y, location.z);

            // 玩家自己的位置
            if (EntityFactory.MainHeroView == null || !EntityFactory.MainHeroView.IsValid)
            {
                return;
            }
            Vector3 selfPositon = msgData.vNewPos;

            // 与NPC距离超过20M,关闭NPC窗口
            if (Vector3.Distance(NPCPosition, selfPositon) > 20)
            {
                m_wnd.SetVisible(false);
                //onClickClose();
            }
        }