1
This commit is contained in:
@@ -91,12 +91,12 @@ namespace BITKit
|
||||
{
|
||||
|
||||
}
|
||||
public void Movement(Vector3 relativeVector)
|
||||
public void OnMovement(Vector3 relativeVector)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Movement(InputAction.CallbackContext context)
|
||||
public void OnMovement(InputAction.CallbackContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@@ -369,7 +369,13 @@ namespace BITFALL.Guns
|
||||
animator.animator.SetBool((int)BITHash.Player.Cancel,
|
||||
recoilSpring.value.GetLength()>0.1f);
|
||||
animator.animator.SetFloat((int)BITHash.Player.Aim,_equipService.Zoom.Value);
|
||||
animator.animator.SetFloat(BITConstant.Player.SqrMagnitude,_movement.LocomotionBasedVelocity.sqrMagnitude);
|
||||
animator.animator.SetFloat(BITConstant.Player.SqrMagnitude,
|
||||
math.clamp(
|
||||
_movement.LocomotionBasedVelocity.sqrMagnitude
|
||||
,0,1
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
recoilSpring.Update(deltaTime,default);
|
||||
|
||||
|
@@ -12,7 +12,7 @@ using Unity.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
namespace BITFALL.Melee
|
||||
namespace BITFALL.Combat
|
||||
{
|
||||
[Serializable]
|
||||
public class MeleeServiceSingleton : IMeleeService
|
||||
|
@@ -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);
|
||||
|
@@ -72,6 +72,8 @@ namespace BITFALL.UX
|
||||
[UXBindPath("bloody-container")]
|
||||
private VisualElement bloodyContainer;
|
||||
|
||||
private VisualElement[] swayElements;
|
||||
|
||||
private float _currentHealthLerp;
|
||||
|
||||
protected CancellationTokenSource bloodyScreenCancellationTokenSource;
|
||||
@@ -91,6 +93,8 @@ namespace BITFALL.UX
|
||||
|
||||
bloodyContainer.SetOpacity(0);
|
||||
injuryContainer.SetOpacity(0);
|
||||
|
||||
swayElements = document.rootVisualElement.Query(className: "swap").ToList().ToArray();
|
||||
}
|
||||
|
||||
private void OnInspect(InputAction.CallbackContext obj)
|
||||
@@ -268,7 +272,6 @@ namespace BITFALL.UX
|
||||
}
|
||||
|
||||
{
|
||||
var currentPos = document.rootVisualElement.transform.position;
|
||||
var movementVelocity = _entityMovement.LocomotionBasedVelocity * 16;
|
||||
var velocity =
|
||||
-_entityMovement.AngularVelocity * 10
|
||||
@@ -278,8 +281,16 @@ namespace BITFALL.UX
|
||||
x = velocity.y,
|
||||
y = velocity.x,
|
||||
};
|
||||
newPos = Vector3.Lerp(currentPos, newPos, Time.deltaTime * 10);
|
||||
document.rootVisualElement.transform.position = newPos;
|
||||
|
||||
|
||||
foreach (var x in swayElements)
|
||||
{
|
||||
var currentPos = x.transform.position;
|
||||
|
||||
newPos = Vector3.Lerp(currentPos, newPos, Time.deltaTime * 10);
|
||||
|
||||
x.transform.position = newPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +316,7 @@ namespace BITFALL.UX
|
||||
healthBar.Set(Mathf.Clamp(hp,0,100) * 0.01f);
|
||||
|
||||
injuryContainer.SetOpacity(
|
||||
hp<50 ? 1 : 0
|
||||
hp< 60 ? Mathf.InverseLerp(40,60,hp) : 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user