public override void OnSyncedUpdate() { bool MouseLeft = FrameSyncInput.GetBool((byte)OPER_CMD.MOUSE_LEFT); bool MouseRight = FrameSyncInput.GetBool((byte)OPER_CMD.MOUSE_RIGHT); FPVector MousePosition = FrameSyncInput.GetFPVector((byte)OPER_CMD.MOUSE_POSITION); if ((MouseLeft || MouseRight) && !GameUtils.IsCursorOverUI())//如果鼠标不是点击在UI上面 { var ray = Camera.main.ScreenPointToRay(MousePosition.ToVector()); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (MouseLeft) { GameEntity targetEntity = hit.transform.GetComponent <GameEntity>(); if (targetEntity) { SetIndicatorViaParent(hit.transform); //地图上标记目的地 if (CanCastSkill(SKILL_NMAE.SKILL_1, targetEntity)) //平A { CastSkill(SKILL_NMAE.SKILL_1, targetEntity); } } } else if (MouseRight) { GameEntity targetEntity = hit.transform.GetComponent <GameEntity>(); if (targetEntity) { SetIndicatorViaParent(hit.transform);//地图上标记目的地 } } else { } } } }
public override void OnSyncedUpdate() { DealSycncedEndInfo(); FPVector changeForwardVec3 = FrameSyncInput.GetFPVector((byte)E_InputId.E_DRAGGING_CAMERA); bool IdelFlag = FrameSyncInput.GetBool((byte)E_InputId.E_IDEL); FP move_x = FrameSyncInput.GetFP((byte)E_InputId.E_MOVE_X); FP move_y = FrameSyncInput.GetFP((byte)E_InputId.E_MOVE_Y); bool mouseDraggingFlag = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAGGING); bool mouseDragEndFlag = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAGEND); if (mouseDraggingFlag || mouseDragEndFlag) { bool leftDirection = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAG_LEFT); bool rightDirection = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAG_RIGHT); ComMoveFollowObj.SetMouseDragDirection(leftDirection, rightDirection); if (mouseDraggingFlag) { ComMoveFollowObj.SetMouseDragFlag(true); } else { ComMoveFollowObj.SetMouseDragFlag(false); } } if (changeForwardVec3 != FPVector.zero) { Debug.Log("changeForwardVec3:::::::::::" + changeForwardVec3.ToVector() + ",,,E_InputId.E_IDEL::" + IdelFlag); Debug.Log("FP_FP_FP_::move_x_xxxxxxxx::" + move_x.AsFloat() + ",move_y::" + move_y.AsFloat()); } //移动处理 if (IdelFlag) { Idle(); ComMoveFollowObj.SetJoyStickMoveFlag(false); //Debug.Log("idelidelidelidelidelidelidelidelidelidelidelidelidelidelidel"); } else { if (move_x != 0 || move_y != 0) { if (changeForwardVec3 != FPVector.zero) { Debug.Log("changeForwardVec3::" + changeForwardVec3.ToVector() + "camera::" + ComMoveFollowObj.transform.forward + ",touch:::" + ComMoveFollowObj._bTouchMouse); ChangeAvatarForward(changeForwardVec3); // Debug.Log("changeForwardVec3:::::::::::" + changeForwardVec3.ToVector() +"camera::"+ ComMoveFollowObj.transform.forward); } SycnMove(move_x, move_y); } } //射击处理 bool shootDownFlag = FrameSyncInput.GetBool((byte)E_InputId.E_SHOOT_DOWN); if (shootDownFlag) { Shoot(changeForwardVec3); } bool shootUpFlag = FrameSyncInput.GetBool((byte)E_InputId.E_SHOOT_UP); if (shootUpFlag) { Shoot(FPVector.zero, false); } //跳跃处理 bool jumpFlag = FrameSyncInput.GetBool((byte)E_InputId.E_JUMP); if (jumpFlag) { Jump(); } //模型改变处理 int modelRender = FrameSyncInput.GetInt((byte)E_InputId.E_CHANGE_MODEL); if (modelRender > 0) { if (modelRender == (int)KeyCode.P) //人形 { ChangeAvatarForm(Avatar.E_AvatarForm.PERSON_STATE); } else if (modelRender == (int)KeyCode.F) //乌贼 { ChangeAvatarForm(Avatar.E_AvatarForm.INKFISH_STATE); } else if (modelRender == (int)KeyCode.D) //下潜模式 { ChangeAvatarForm(Avatar.E_AvatarForm.INKFISHDIVE_STATE); } } //更换装备 int replaceWeaponFlag = FrameSyncInput.GetInt((byte)E_InputId.E_REPLACE_WEAPON); if (replaceWeaponFlag > 0) { ChangeWeapon(replaceWeaponFlag); } //扔手雷 bool throwGrenadeFlag = FrameSyncInput.GetBool((byte)E_InputId.E_THROW_GRENADE); if (throwGrenadeFlag) { ThrowGrenade(); } }