BloodAndGore/Assets/Scripts/Utils/BobbingRandomizer.cs

25 lines
702 B
C#
Raw Normal View History

2019-08-22 20:36:22 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Effects;
namespace Saltosion.OneWeapon.Utils {
public class BobbingRandomizer : MonoBehaviour {
public float Variety = 0.05f;
public AcceleratedMovement Movement;
public Bobbing Bobbing;
void Start() {
float RandomOffset = Random.value * (Variety * 2) - Variety;
if (Movement != null) {
Movement.AnimationSpeedModifier = 1 + RandomOffset;
}
if (Bobbing != null) {
Bobbing.BobbingLaunchSpeed = Bobbing.BobbingLaunchSpeed * (1 + RandomOffset);
}
}
}
}