public override void Start()
{
base.Start();
// handle negative acceleration, 0 maxSpeed
maxSpeed = Mathf.Max(Mathf.Abs(maxSpeed), 0.01f);
if (accel<0) {
accelMult = -1;
accel = Mathf.Abs(accel);
}
if (Application.isPlaying) {
move = gameObject.AddComponent<AudioSource>();
collHit = gameObject.AddComponent<AudioSource>();
hitSurface = gameObject.AddComponent<AudioSource>();
move.clip = _move.clip;
collHit.clip = _collHit.clip;
hitSurface.clip = _hitSurface.clip;
move.loop = true;
collHit.loop = false;
hitSurface.loop = false;
Vector3 v = transform.TransformDirection(Vector3.right);
origAngle = Mathf.Atan2(v.y, v.x);
if (accel<0.001f) accelMult = 0;
}
}