started building NPC combat
This commit is contained in:
@@ -307,6 +307,7 @@ namespace Synty.AnimationBaseLocomotion.Samples
|
||||
private float _strafeDirectionX;
|
||||
private float _strafeDirectionZ;
|
||||
private GameObject _currentLockOnTarget;
|
||||
public GameObject CurrentLockOnTarget => _isLockedOn ? _currentLockOnTarget : null;
|
||||
private GaitState _currentGait;
|
||||
private Transform _targetLockOnPos;
|
||||
private Vector3 _currentRotation = new Vector3(0f, 0f, 0f);
|
||||
@@ -743,7 +744,8 @@ namespace Synty.AnimationBaseLocomotion.Samples
|
||||
{
|
||||
if (_currentLockOnTarget != null)
|
||||
{
|
||||
_targetLockOnPos.position = _currentLockOnTarget.transform.position;
|
||||
// Look at the chest/head area rather than the feet
|
||||
_targetLockOnPos.position = _currentLockOnTarget.transform.position + (Vector3.up * 1.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1372,6 +1374,13 @@ namespace Synty.AnimationBaseLocomotion.Samples
|
||||
/// </summary>
|
||||
private void LocomotionToJumpState()
|
||||
{
|
||||
PlayerStats stats = GetComponent<PlayerStats>();
|
||||
if (stats != null)
|
||||
{
|
||||
if (stats.currentStamina < 15f) return; // Prevent jump
|
||||
stats.UseStamina(15f); // Use stamina for jumping
|
||||
}
|
||||
|
||||
SwitchState(AnimationState.Jump);
|
||||
}
|
||||
|
||||
@@ -1533,6 +1542,13 @@ namespace Synty.AnimationBaseLocomotion.Samples
|
||||
{
|
||||
if (!_cannotStandUp)
|
||||
{
|
||||
PlayerStats stats = GetComponent<PlayerStats>();
|
||||
if (stats != null)
|
||||
{
|
||||
if (stats.currentStamina < 15f) return; // Prevent jump
|
||||
stats.UseStamina(15f); // Use stamina for jumping
|
||||
}
|
||||
|
||||
DeactivateCrouch();
|
||||
SwitchState(AnimationState.Jump);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user