new input
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -169,7 +169,7 @@ namespace NBF
|
|||||||
PlayerID = 100 + index
|
PlayerID = 100 + index
|
||||||
};
|
};
|
||||||
|
|
||||||
var add = Random.Range(0, 5f) + index * 0.5f;
|
var add = 0;//Random.Range(0, 5f) + index * 0.5f;
|
||||||
|
|
||||||
player.position = new Vector3(261.546f + add, 3, 422.366f);
|
player.position = new Vector3(261.546f + add, 3, 422.366f);
|
||||||
player.rotation = quaternion.identity;
|
player.rotation = quaternion.identity;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using DG.Tweening;
|
||||||
using DG.Tweening;
|
|
||||||
using NBC;
|
using NBC;
|
||||||
using NBF;
|
using NBF;
|
||||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
|
|
||||||
using RootMotion.FinalIK;
|
using RootMotion.FinalIK;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -25,8 +23,6 @@ public partial class FPlayer : MonoBehaviour
|
|||||||
|
|
||||||
private float interactionTargetWeight;
|
private float interactionTargetWeight;
|
||||||
|
|
||||||
public bool isLeftHandVisable;
|
|
||||||
|
|
||||||
[HideInInspector] public float handPullUp;
|
[HideInInspector] public float handPullUp;
|
||||||
|
|
||||||
public Fsm<FPlayer> Fsm { get; private set; }
|
public Fsm<FPlayer> Fsm { get; private set; }
|
||||||
@@ -82,13 +78,13 @@ public partial class FPlayer : MonoBehaviour
|
|||||||
|
|
||||||
if (data.PlayerID == GameModel.RoleID)
|
if (data.PlayerID == GameModel.RoleID)
|
||||||
{
|
{
|
||||||
var mainSync = gameObject.AddComponent<FPlayerMainSync>();
|
// var mainSync = gameObject.AddComponent<FPlayerMainSync>();
|
||||||
BaseCamera.Main.transform.SetParent(CameraRoot);
|
BaseCamera.Main.transform.SetParent(CameraRoot);
|
||||||
BaseCamera.Main.transform.localPosition = Vector3.zero;
|
BaseCamera.Main.transform.localPosition = Vector3.zero;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var otherSync = gameObject.AddComponent<FPlayerOtherSync>();
|
// var otherSync = gameObject.AddComponent<FPlayerOtherSync>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
Assets/Scripts/Fishing/Player/PlayerCharacter.meta
Normal file
3
Assets/Scripts/Fishing/Player/PlayerCharacter.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 26646598ef364c52809720f314858335
|
||||||
|
timeCreated: 1747495726
|
||||||
159
Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerCharacter.cs
Normal file
159
Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerCharacter.cs
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
using System;
|
||||||
|
using ECM2;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NBF
|
||||||
|
{
|
||||||
|
public class PlayerCharacter : Character
|
||||||
|
{
|
||||||
|
[Tooltip("The first person camera parent.")]
|
||||||
|
public GameObject cameraParent;
|
||||||
|
|
||||||
|
private float _cameraPitch;
|
||||||
|
private FPlayer _player;
|
||||||
|
[HideInInspector] public int nextShowSlotIndex = -1;
|
||||||
|
|
||||||
|
|
||||||
|
[Space(15.0f)] public bool invertLook = true;
|
||||||
|
[Tooltip("Look sensitivity")] public Vector2 sensitivity = new Vector2(0.05f, 0.05f);
|
||||||
|
|
||||||
|
[Space(15.0f)] [Tooltip("How far in degrees can you move the camera down.")]
|
||||||
|
public float minPitch = -80.0f;
|
||||||
|
|
||||||
|
[Tooltip("How far in degrees can you move the camera up.")]
|
||||||
|
public float maxPitch = 80.0f;
|
||||||
|
|
||||||
|
protected override void Start()
|
||||||
|
{
|
||||||
|
base.Start();
|
||||||
|
camera = BaseCamera.Main;
|
||||||
|
|
||||||
|
_player = GetComponent<FPlayer>();
|
||||||
|
|
||||||
|
transform.position = _player.Data.position;
|
||||||
|
transform.rotation = _player.Data.rotation;
|
||||||
|
|
||||||
|
App.Inst.SetMouseCurrsor(false);
|
||||||
|
|
||||||
|
InputManager.OnQuickIndexAction += OnQuickIndexAction;
|
||||||
|
InputManager.OnUseTorchAction += OnUseTorchAction;
|
||||||
|
InputManager.OnUseTelescopeAction += OnUseTelescopeAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
// Move
|
||||||
|
|
||||||
|
Vector2 movementInput = InputManager.GetMovementInput();
|
||||||
|
|
||||||
|
Vector3 movementDirection = Vector3.zero;
|
||||||
|
|
||||||
|
movementDirection += Vector3.forward * movementInput.y;
|
||||||
|
movementDirection += Vector3.right * movementInput.x;
|
||||||
|
|
||||||
|
movementDirection =
|
||||||
|
movementDirection.relativeTo(cameraTransform, GetUpVector());
|
||||||
|
|
||||||
|
SetMovementDirection(movementDirection);
|
||||||
|
|
||||||
|
// Look
|
||||||
|
|
||||||
|
Vector2 lookInput = InputManager.GetLookInput() * sensitivity;
|
||||||
|
|
||||||
|
AddControlYawInput(lookInput.x);
|
||||||
|
AddControlPitchInput(invertLook ? -lookInput.y : lookInput.y, minPitch, maxPitch);
|
||||||
|
|
||||||
|
|
||||||
|
if (_player.CanChangeGear())
|
||||||
|
{
|
||||||
|
if (nextShowSlotIndex > 0)
|
||||||
|
{
|
||||||
|
Debug.LogError("切换钓组=========");
|
||||||
|
var data = Fishing.Inst.Datasource;
|
||||||
|
data.SetSelfTestGear(nextShowSlotIndex);
|
||||||
|
nextShowSlotIndex = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
InputManager.OnQuickIndexAction -= OnQuickIndexAction;
|
||||||
|
InputManager.OnUseTorchAction -= OnUseTorchAction;
|
||||||
|
InputManager.OnUseTelescopeAction -= OnUseTelescopeAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnQuickIndexAction(int index)
|
||||||
|
{
|
||||||
|
nextShowSlotIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUseTorchAction(bool ret)
|
||||||
|
{
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
_player.Data.openLight = !_player.Data.openLight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUseTelescopeAction(bool ret)
|
||||||
|
{
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
_player.Data.openTelescope = !_player.Data.openTelescope;
|
||||||
|
_player.ToggleTelescope();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add input (affecting Yaw).
|
||||||
|
/// This is applied to the Character's rotation.
|
||||||
|
/// </summary>
|
||||||
|
public virtual void AddControlYawInput(float value)
|
||||||
|
{
|
||||||
|
if (value != 0.0f)
|
||||||
|
AddYawInput(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add input (affecting Pitch).
|
||||||
|
/// This is applied to the cameraParent's local rotation.
|
||||||
|
/// </summary>
|
||||||
|
public virtual void AddControlPitchInput(float value, float minPitch = -80.0f, float maxPitch = 80.0f)
|
||||||
|
{
|
||||||
|
if (value != 0.0f)
|
||||||
|
_cameraPitch = MathLib.ClampAngle(_cameraPitch + value, minPitch, maxPitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update cameraParent local rotation applying current _cameraPitch value.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void UpdateCameraParentRotation()
|
||||||
|
{
|
||||||
|
cameraParent.transform.localRotation = Quaternion.Euler(_cameraPitch, 0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If overriden, base method MUST be called.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void LateUpdate()
|
||||||
|
{
|
||||||
|
UpdateCameraParentRotation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If overriden, base method MUST be called.
|
||||||
|
/// </summary>
|
||||||
|
protected override void Reset()
|
||||||
|
{
|
||||||
|
// Call base method implementation
|
||||||
|
|
||||||
|
base.Reset();
|
||||||
|
|
||||||
|
// Disable character's rotation,
|
||||||
|
// it is handled by the AddControlYawInput method
|
||||||
|
|
||||||
|
SetRotationMode(RotationMode.None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dcefd1090dc44a539b4fcd30f2adf503
|
||||||
|
timeCreated: 1747495536
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d9f9a5be72134763b20ce6c08ff84b0d
|
|
||||||
timeCreated: 1744122878
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
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<FirstPersonController>();
|
|
||||||
walkingSpeed = firstPersonController.m_WalkSpeed;
|
|
||||||
runningSpeed = firstPersonController.m_RunSpeed;
|
|
||||||
_player = GetComponent<FPlayer>();
|
|
||||||
|
|
||||||
|
|
||||||
transform.position = _player.Data.position;
|
|
||||||
transform.rotation = _player.Data.rotation;
|
|
||||||
|
|
||||||
|
|
||||||
Timer.Once(1f, this, EnableFirstPersonController);
|
|
||||||
|
|
||||||
App.Inst.SetMouseCurrsor(false);
|
|
||||||
|
|
||||||
InputManager.OnQuickIndexAction += OnQuickIndexAction;
|
|
||||||
InputManager.OnUseTorchAction += OnUseTorchAction;
|
|
||||||
InputManager.OnUseTelescopeAction += OnUseTelescopeAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDestroy()
|
|
||||||
{
|
|
||||||
InputManager.OnQuickIndexAction -= OnQuickIndexAction;
|
|
||||||
InputManager.OnUseTorchAction -= OnUseTorchAction;
|
|
||||||
InputManager.OnUseTelescopeAction -= OnUseTelescopeAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EnableFirstPersonController()
|
|
||||||
{
|
|
||||||
firstPersonController.enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnQuickIndexAction(int index)
|
|
||||||
{
|
|
||||||
nextShowSlotIndex = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUseTorchAction(bool ret)
|
|
||||||
{
|
|
||||||
if (!ret)
|
|
||||||
{
|
|
||||||
_player.Data.openLight = !_player.Data.openLight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUseTelescopeAction(bool ret)
|
|
||||||
{
|
|
||||||
if (!ret)
|
|
||||||
{
|
|
||||||
_player.Data.openTelescope = !_player.Data.openTelescope;
|
|
||||||
_player.ToggleTelescope();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
var movementAxis = InputManager.GetMovementInput();
|
|
||||||
if (movementAxis != Vector2.zero)
|
|
||||||
{
|
|
||||||
// Debug
|
|
||||||
}
|
|
||||||
|
|
||||||
firstPersonController.horizontal = movementAxis.x;
|
|
||||||
firstPersonController.vertical = 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (_player.CanChangeGear())
|
|
||||||
{
|
|
||||||
if (nextShowSlotIndex > 0)
|
|
||||||
{
|
|
||||||
Debug.LogError("切换钓组=========");
|
|
||||||
var data = Fishing.Inst.Datasource;
|
|
||||||
data.SetSelfTestGear(nextShowSlotIndex);
|
|
||||||
nextShowSlotIndex = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FixedUpdate()
|
|
||||||
{
|
|
||||||
if (_player.MainArm)
|
|
||||||
{
|
|
||||||
// _player.MainArm.Shoulder.SetCameraEulerAngleX(BaseCamera.Main.transform.localEulerAngles.x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 29e1feb22aa646bf9280b5ceab67cf3f
|
|
||||||
timeCreated: 1743937049
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using UnityStandardAssets.Characters.FirstPerson;
|
|
||||||
|
|
||||||
namespace NBF
|
|
||||||
{
|
|
||||||
public class FPlayerOtherSync : MonoBehaviour
|
|
||||||
{
|
|
||||||
public FirstPersonController firstPersonController;
|
|
||||||
private float walkingSpeed = 1f;
|
|
||||||
|
|
||||||
private float runningSpeed = 2f;
|
|
||||||
|
|
||||||
private FPlayer _player;
|
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
firstPersonController = GetComponent<FirstPersonController>();
|
|
||||||
walkingSpeed = firstPersonController.m_WalkSpeed;
|
|
||||||
runningSpeed = firstPersonController.m_RunSpeed;
|
|
||||||
_player = GetComponent<FPlayer>();
|
|
||||||
|
|
||||||
transform.position = _player.Data.position;
|
|
||||||
transform.rotation = _player.Data.rotation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: fa1161cd1ad944c38bbc33fdcc0ec321
|
|
||||||
timeCreated: 1744122890
|
|
||||||
@@ -9,34 +9,34 @@ EditorUserSettings:
|
|||||||
value: 18134705175a055722080a3115371d4a0d55006876786860616b0471b8b07a68ffab74f9ee2a3a30300cea1a11320d0beb1a0c25f7060f494b4cc80018eb09361fc211cb1f862d19c51d19dcc413d6ade0d8ddfcddf9f4d9d29195fcfde6ebeae6f0a9c9afa6f8c5b89ff7a1aacececac4eba4d7c9d28bda
|
value: 18134705175a055722080a3115371d4a0d55006876786860616b0471b8b07a68ffab74f9ee2a3a30300cea1a11320d0beb1a0c25f7060f494b4cc80018eb09361fc211cb1f862d19c51d19dcc413d6ade0d8ddfcddf9f4d9d29195fcfde6ebeae6f0a9c9afa6f8c5b89ff7a1aacececac4eba4d7c9d28bda
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-0:
|
RecentlyUsedSceneGuid-0:
|
||||||
value: 5a00505e51040c59550b097016700f44451649797c7e2265282d486bbab0376d
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedSceneGuid-1:
|
|
||||||
value: 000104565554500c0c5c547013720c44154e4a2e7e7c2264742d4a65e3b7613e
|
value: 000104565554500c0c5c547013720c44154e4a2e7e7c2264742d4a65e3b7613e
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-2:
|
RecentlyUsedSceneGuid-1:
|
||||||
value: 070903035354510c085e557541250b44174f4c28757922327d2b4b61b7b8306a
|
value: 070903035354510c085e557541250b44174f4c28757922327d2b4b61b7b8306a
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-3:
|
RecentlyUsedSceneGuid-2:
|
||||||
value: 55030157570d5108595b557213770a47434e4d7f797e27667e2a1963e6b2323b
|
value: 55030157570d5108595b557213770a47434e4d7f797e27667e2a1963e6b2323b
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-4:
|
RecentlyUsedSceneGuid-3:
|
||||||
value: 5407555107065c0c550a0d7645260e4410151a7e7a71706729781c31e6b86469
|
value: 5407555107065c0c550a0d7645260e4410151a7e7a71706729781c31e6b86469
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-5:
|
RecentlyUsedSceneGuid-4:
|
||||||
value: 05010d5107025b5d5b0f0a24487b5c44154f49787c7877612b7a4c35b1b86d69
|
value: 05010d5107025b5d5b0f0a24487b5c44154f49787c7877612b7a4c35b1b86d69
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-6:
|
RecentlyUsedSceneGuid-5:
|
||||||
value: 5057005200535b5808565a75457a0b4414161b7b2e7e74322979186ab2e6323a
|
value: 5057005200535b5808565a75457a0b4414161b7b2e7e74322979186ab2e6323a
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-7:
|
RecentlyUsedSceneGuid-6:
|
||||||
value: 5403075056035e03540c0e7b467707411416492c7e292734752b456bb1b73161
|
value: 5403075056035e03540c0e7b467707411416492c7e292734752b456bb1b73161
|
||||||
flags: 0
|
flags: 0
|
||||||
|
RecentlyUsedSceneGuid-7:
|
||||||
|
value: 0652525052015d5f5e5f0e7147700744464e4a7f2a2c72342f2d4930e0e66560
|
||||||
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-8:
|
RecentlyUsedSceneGuid-8:
|
||||||
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
value: 0150055704510808545c0a26467506444516197a747874637b7e1860b5b6616c
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-9:
|
RecentlyUsedSceneGuid-9:
|
||||||
value: 0150055704510808545c0a26467506444516197a747874637b7e1860b5b6616c
|
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
||||||
flags: 0
|
flags: 0
|
||||||
vcSharedLogLevel:
|
vcSharedLogLevel:
|
||||||
value: 0d5e400f0650
|
value: 0d5e400f0650
|
||||||
|
|||||||
Reference in New Issue
Block a user