1
This commit is contained in:
@@ -13,6 +13,7 @@ using BITKit.Entities.Movement;
|
||||
using BITKit.Entities.Physics;
|
||||
using BITKit.Entities.Player;
|
||||
using BITKit.PlayerCamera;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Lightbug.CharacterControllerPro.Core;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
@@ -151,11 +152,11 @@ namespace BITFALL.Entities.Player.Movement
|
||||
TransitionState<Walk>();
|
||||
|
||||
|
||||
_inputActionGroup.RegisterCallback(movementAction, Movement);
|
||||
_inputActionGroup.RegisterCallback(viewAction, View);
|
||||
_inputActionGroup.RegisterCallback(jumpAction, Jump);
|
||||
_inputActionGroup.RegisterCallback(crouchAction, Crouch);
|
||||
_inputActionGroup.RegisterCallback(runAction, Run);
|
||||
_inputActionGroup.RegisterCallback(movementAction, OnMovement);
|
||||
_inputActionGroup.RegisterCallback(viewAction, OnView);
|
||||
_inputActionGroup.RegisterCallback(jumpAction, OnJump);
|
||||
_inputActionGroup.RegisterCallback(crouchAction, OnCrouch);
|
||||
_inputActionGroup.RegisterCallback(runAction, OnRun);
|
||||
}
|
||||
private void OnSetPhysics(bool obj)
|
||||
{
|
||||
@@ -167,8 +168,9 @@ namespace BITFALL.Entities.Player.Movement
|
||||
|
||||
private void OnSetAlive(bool obj)
|
||||
{
|
||||
allowMovement.SetElements(this,obj);
|
||||
allowRun.SetElements(this,obj);
|
||||
|
||||
allowMovement.SetElements(123,obj);
|
||||
allowRun.SetElements(123,obj);
|
||||
if (obj)
|
||||
{
|
||||
if (!isDead) return;
|
||||
@@ -186,11 +188,11 @@ namespace BITFALL.Entities.Player.Movement
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void Movement(Vector3 relativeVector)
|
||||
public void OnMovement(Vector3 relativeVector)
|
||||
{
|
||||
MovementInput = relativeVector;
|
||||
}
|
||||
public void Movement(InputAction.CallbackContext context)
|
||||
public void OnMovement(InputAction.CallbackContext context)
|
||||
{
|
||||
MovementInput = context.ReadValue<Vector2>();
|
||||
MovementInput = new Vector3(MovementInput.x,0,MovementInput.y);
|
||||
@@ -205,8 +207,8 @@ namespace BITFALL.Entities.Player.Movement
|
||||
ExpectSprint.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void ExecuteCommand<T>(T command=default)
|
||||
|
||||
public void ExecuteCommand<T>(T command=default)
|
||||
{
|
||||
foreach (var x in StateDictionary.Values)
|
||||
{
|
||||
@@ -233,7 +235,7 @@ namespace BITFALL.Entities.Player.Movement
|
||||
gravityDamping.Release(addGravityDampingCommand.Damping);
|
||||
break;
|
||||
case PlayerPauseRunCommand pauseRunCommand:
|
||||
pauseRun.SetElements(this,pauseRunCommand.Pause);
|
||||
pauseRun.SetElements(123,pauseRunCommand.Pause);
|
||||
break;
|
||||
case PlayerFocusCommand focusCommand:
|
||||
allowFocus.SetElements(focusCommand.Sender,focusCommand.Focus);
|
||||
@@ -253,7 +255,7 @@ namespace BITFALL.Entities.Player.Movement
|
||||
}
|
||||
public event Action<object> OnCommand;
|
||||
|
||||
public void View(InputAction.CallbackContext context)
|
||||
public void OnView(InputAction.CallbackContext context)
|
||||
{
|
||||
if (BITAppForUnity.AllowCursor) return;
|
||||
var playerConfig = PlayerConfig.Singleton;
|
||||
@@ -293,12 +295,9 @@ namespace BITFALL.Entities.Player.Movement
|
||||
-raw.x
|
||||
);
|
||||
}
|
||||
public void Jump(InputAction.CallbackContext context)
|
||||
public void OnJump(InputAction.CallbackContext context)
|
||||
{
|
||||
if (_knockdown.IsKnockdown) return;
|
||||
|
||||
var y = actor.ColliderComponent.Size.y;
|
||||
|
||||
|
||||
|
||||
RequestClimb = context switch
|
||||
@@ -306,10 +305,9 @@ namespace BITFALL.Entities.Player.Movement
|
||||
{ interaction: PressInteraction, performed: true } => true,
|
||||
{ interaction: PressInteraction, canceled: true } => false,
|
||||
_ => RequestClimb
|
||||
};
|
||||
};
|
||||
|
||||
if (ExpectJump.shouldBe) return;
|
||||
if (context is not {interaction:PressInteraction , performed:true}) return;
|
||||
|
||||
switch (CurrentState)
|
||||
{
|
||||
@@ -373,7 +371,7 @@ namespace BITFALL.Entities.Player.Movement
|
||||
}
|
||||
ExpectCrouch.Reset();
|
||||
}
|
||||
public void Run(InputAction.CallbackContext context)
|
||||
public void OnRun(InputAction.CallbackContext context)
|
||||
{
|
||||
if (allowRun.Allow is false) return;
|
||||
if (_knockdown.IsKnockdown) return;
|
||||
@@ -419,7 +417,7 @@ namespace BITFALL.Entities.Player.Movement
|
||||
|
||||
}
|
||||
|
||||
public void Crouch(InputAction.CallbackContext context)
|
||||
public void OnCrouch(InputAction.CallbackContext context)
|
||||
{
|
||||
if (_knockdown.IsKnockdown) return;
|
||||
|
||||
@@ -524,12 +522,9 @@ namespace BITFALL.Entities.Player.Movement
|
||||
}
|
||||
|
||||
if (allowMovement.Allow is false) return;
|
||||
var additiveTransform = locationAdditive.transform;
|
||||
|
||||
|
||||
var rotation = Quaternion.Euler(LookInput);
|
||||
|
||||
|
||||
|
||||
if (LimitViewAngle is not 0)
|
||||
{
|
||||
float angleDifference = Quaternion.Angle(rotation, FpvRotation);
|
||||
|
Reference in New Issue
Block a user