12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using Controller.Bicycle;
- using UnityEngine;
- using Wheels;
- namespace Phscs
- {
- [RequireComponent(typeof(RbBicycleController))]
- public class RbBicycleSlopeSpeedManager : MonoBehaviour
- {
- [Header("Game Objects")] public LerpSlopeCollider slopeCollider;
- [Header("Linear Adjustment")] [Range(0, 3)]
- public float speedFactorUphill;
- [Range(0, 3)] public float speedFactorDownhill;
- private BikeSpeedBooster speedBooster;
- public float GradientDeg { get; private set; }
- private void Start()
- {
- speedBooster = BikeSpeedBooster.Instance;
- slopeCollider.OnSlopeChanged += (timestamp, slope) =>
- {
- speedBooster.OnSlopeChanged(timestamp, slope);
- GradientDeg = slope;
- };
- }
- private void FixedUpdate()
- {
- speedBooster.OnFixedUpdate();
- }
- }
- }
|