This commit is contained in:
CortexCore
2023-12-15 20:03:44 +08:00
parent 1f5b779aa1
commit 2fe611c0d5
66 changed files with 10794 additions and 8815 deletions

View File

@@ -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
);
}
}