예제 #1
0
    // 骑乘button
    void RidingButton(GameObject value)
    {
        // 给服务器发消息 骑乘
        // 客户端模拟
        int nMountID = GameManager.gameManager.PlayerDataPool.m_objMountParam.MountID;

        if (nMountID != m_CurMountID)
        {
            // 没有的坐骑 弹提示

            if (false == GameManager.gameManager.PlayerDataPool.m_objMountParam.GetMountCollectFlag(m_CurMountID))
            {
                Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{3051}");

                return;
            }
            else
            {
                GameManager.gameManager.SoundManager.PlaySoundEffect(30);
                //Singleton<ObjManager>.GetInstance().MainPlayer.RideMount(m_CurMountID);
                CG_MOUNT_MOUNT packet = (CG_MOUNT_MOUNT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_MOUNT_MOUNT);
                packet.SetMountID(m_CurMountID);
                packet.SendPacket();

                Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

                if (mainPlayer != null)
                {
                    mainPlayer.PlayerStopMountSound();
                }
            }
        }
        else // 下坐骑
        {
            //Singleton<ObjManager>.GetInstance().MainPlayer.UnMount();
            CG_MOUNT_UNMOUNT packet = (CG_MOUNT_UNMOUNT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_MOUNT_UNMOUNT);
            packet.SetMountID(m_CurMountID);
            packet.SendPacket();

            Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            if (mainPlayer != null)
            {
                mainPlayer.NoPlayerStopMountSound();
            }
        }

        /*if (PartnerAndMountLogic.Instance())
         * {
         *  PartnerAndMountLogic.Instance().CloseWindow();
         * }*/
    }
예제 #2
0
        public void StopMove()
        {
            if (null != NavAgent && NavAgent.enabled == true)
            {
                NavAgent.Stop();
                //如果在moveto时 禁用了旋转 移动结束后 重新置为打开
                if (IsMoveToNoFaceTo)
                {
                    EnableMovingRotation(true);
                    IsMoveToNoFaceTo = false;
                }
            }

            if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
//                Obj_MainPlayer MainPlayer = this as Obj_MainPlayer;
                //if (MainPlayer.Thirdcontroller != null && MainPlayer.Thirdcontroller.IsMoving)
                //{
                //    CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_WALK;
                //}
                //else
                //{
                CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_NORMOR;
                //}
                //取消地面移动特效
                if (null != GameManager.gameManager.ActiveScene)
                {
                    GameManager.gameManager.ActiveScene.DeactiveMovingCircle();
                }
            }
            else
            {
#if UNITY_ANDROID
                if (ObjType != Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
#endif
                CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_NORMOR;

#if UNITY_ANDROID
            }
#endif
            }

            //正常结束处理
            bool isPlayerSound = m_bIsMoving;
            m_bIsMoving  = false;
            m_bIsTracing = false;
            float fDis = Vector3.Distance(this.Position, m_vecTargetPos);
            if (m_fStopRange - fDis >= 0)
            {
                OnMoveOver();
            }

            //   MoveTarget = null;
            ResetMoveOverEvent();

            //重置移动卡住校验
            m_LastPosition     = Vector3.zero;
            m_LastPositionTime = 0;

            Obj_MainPlayer MainPlayer1 = this as Obj_MainPlayer;
            if (MainPlayer1 != null)
            {
                if (isPlayerSound)
                {
                    MainPlayer1.PlayerStopMountSound();
                    MainPlayer1.PlayerMountStopMoveSound();
                }
            }
        }