Add Hunter NPC and Teleporter features with associated prefabs and effects

This commit is contained in:
2025-12-13 00:01:29 +01:00
parent c0fb207768
commit d8b0583fac
32 changed files with 823 additions and 217 deletions

View File

@@ -9,6 +9,10 @@ namespace Infrastructure.Unity
[SerializeField] private Vector3 offset = new(-20, 20, -20);
[SerializeField] private float smoothSpeed = 5f;
private Vector3 _originalPos; // This field is declared but not used in the provided LateUpdate logic.
private float _shakeTimer;
private float _shakeMagnitude;
private void LateUpdate()
{
if (!target) return;
@@ -17,14 +21,30 @@ namespace Infrastructure.Unity
// so the camera doesn't jitter too much, only tracking Y (falling).
// For a dynamic feel, let's track everything loosely.
var desiredPos = target.position + offset;
transform.position = Vector3.Lerp(transform.position, desiredPos, Time.deltaTime * smoothSpeed);
var targetPos = target.position + offset;
var smoothPos = Vector3.Lerp(transform.position, targetPos, smoothSpeed * Time.deltaTime);
if (_shakeTimer > 0)
{
_shakeTimer -= Time.deltaTime;
var shakeOffset = Random.insideUnitSphere * _shakeMagnitude;
transform.position = smoothPos + shakeOffset;
}
else
{
transform.position = smoothPos;
}
}
public void SetTarget(Transform newTarget)
{
target = newTarget;
}
public void Shake(float duration, float magnitude)
{
_shakeTimer = duration;
_shakeMagnitude = magnitude;
}
}
}