added headshots and enemy's shooting
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user