using System; using NBC; using UnityEngine; using UnityStandardAssets.Characters.FirstPerson; namespace NBF { public class FPlayerMainSync : MonoBehaviour { public FirstPersonController firstPersonController; [HideInInspector] public int nextShowSlotIndex = -1; private float walkingSpeed = 1f; private float runningSpeed = 2f; private FPlayer _player; private void Start() { firstPersonController = GetComponent(); walkingSpeed = firstPersonController.m_WalkSpeed; runningSpeed = firstPersonController.m_RunSpeed; _player = GetComponent(); transform.position = _player.Data.position; transform.rotation = _player.Data.rotation; Timer.Once(1f, this, EnableFirstPersonController); App.Inst.SetMouseCurrsor(false); } private void EnableFirstPersonController() { firstPersonController.enabled = true; } private void Update() { // firstPersonController.horizontal = InputManager.movementAxis.x; // firstPersonController.vertical = InputManager.movementAxis.y; // // firstPersonController.isJumping = InputManager.isJumping; // firstPersonController.isRuning = InputManager.isRunning; // firstPersonController.m_MouseLook.ControllerHandMode = GameManager.Instance._playerData // .Player[GameManager.Instance._playerData.currentPlayerProfileIndex].controllerSetup; if (firstPersonController.isWater) { firstPersonController.m_WalkSpeed = walkingSpeed - Mathf.Abs(transform.position.y - 1f); firstPersonController.m_RunSpeed = firstPersonController.m_WalkSpeed; firstPersonController.m_WalkSpeed = Mathf.Clamp(firstPersonController.m_WalkSpeed, 0.7f, 2f); firstPersonController.m_RunSpeed = Mathf.Clamp(firstPersonController.m_RunSpeed, 0.8f, 2f); } else { firstPersonController.m_WalkSpeed = walkingSpeed; firstPersonController.m_RunSpeed = runningSpeed; } // firstPersonController.m_MouseLook.XSensitivity = // GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex] // .mouseSensitivity * GetPlayerHandPower(); // firstPersonController.m_MouseLook.YSensitivity = // GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex] // .mouseSensitivity * GetPlayerHandPower(); if (_player.CanChangeGear()) { // if (InputManager.isShowSlot0) // { // nextShowSlotIndex = 0; // } // // if (InputManager.isShowSlot1) // { // nextShowSlotIndex = 1; // } // // if (InputManager.isShowSlot2) // { // nextShowSlotIndex = 2; // } // // if (InputManager.isShowSlot3) // { // nextShowSlotIndex = 3; // } // // if (InputManager.isShowSlot4) // { // nextShowSlotIndex = 4; // } if (nextShowSlotIndex != -1) { Debug.LogError("切换钓组========="); var data = Fishing.Inst.Datasource; data.SetSelfTestGear(nextShowSlotIndex); nextShowSlotIndex = -1; } } } } }