added headshots and enemy's shooting

This commit is contained in:
2026-02-18 00:40:22 +00:00
parent 27f2931ce1
commit e1df65bce2
6 changed files with 554 additions and 57 deletions

View File

@@ -37,13 +37,15 @@ public class WeaponBob : MonoBehaviour
bobTimer += Time.deltaTime * bobFrequency * multiplier;
float bobX = Mathf.Sin(bobTimer) * bobHorizontalAmplitude * multiplier;
float bobY = Mathf.Sin(bobTimer * 2f) * bobVerticalAmplitude * multiplier;
// Abs(Sin) means the weapon bounces UP on every step (left and right)
// instead of looping in a circle/figure-8
float bobY = Mathf.Abs(Mathf.Sin(bobTimer)) * bobVerticalAmplitude * multiplier;
transform.localPosition = originalLocalPos + new Vector3(bobX, bobY, 0f);
}
else
{
bobTimer = 0f;
// Don't reset bobTimer so the phase doesn't snap when you start moving again
transform.localPosition = Vector3.Lerp(
transform.localPosition,
originalLocalPos,