Add BobbingFrequency field and make Player bobbing frequency 0.3
This commit is contained in:
parent
8005b41f59
commit
be87b7504c
@ -551,7 +551,8 @@ MonoBehaviour:
|
||||
BobbedTransform: {fileID: 4562179207922364650}
|
||||
BobbingMultiplier: 1
|
||||
BobbingGravity: 0.8
|
||||
BobbingLaunchSpeed: 0.1
|
||||
BobbingLaunchSpeed: 0.12
|
||||
BobbingFrequency: 0
|
||||
BobbingDirection: {x: 0, y: 1}
|
||||
--- !u!1 &8489029732599905358
|
||||
GameObject:
|
||||
|
@ -11,6 +11,9 @@ namespace Saltosion.OneWeapon.Effects {
|
||||
public float BobbingMultiplier = 1;
|
||||
public float BobbingGravity = 0.5f;
|
||||
public float BobbingLaunchSpeed = 5f;
|
||||
|
||||
public float BobbingFrequency = 0;
|
||||
|
||||
public Vector2 BobbingDirection = new Vector2(0, 1);
|
||||
|
||||
private float BobbingSpeed;
|
||||
@ -18,11 +21,13 @@ namespace Saltosion.OneWeapon.Effects {
|
||||
private float CurrentBobbingState = 0;
|
||||
|
||||
void Update() {
|
||||
BobbingFrequency = (BobbingLaunchSpeed * 2) / BobbingGravity;
|
||||
|
||||
BobbingSpeed -= (BobbingGravity / 10 * Time.deltaTime);
|
||||
if (CurrentBobbingState <= 0) {
|
||||
BobbingSpeed = (BobbingLaunchSpeed / 10);
|
||||
}
|
||||
CurrentBobbingState += BobbingSpeed;
|
||||
CurrentBobbingState += BobbingSpeed * BobbingMultiplier;
|
||||
|
||||
BobbedTransform.localPosition = BobbingDirection * CurrentBobbingState * BobbingMultiplier;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user