56 lines
1.3 KiB
C#
Raw Permalink Normal View History

using UnityEngine;
public enum InputType
{
None = 0,
Accel = 1,
Rev = 2,
SteerLeft = 3,
SteerRight = 4,
}
public class InputManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{
private GameplayManager gameplayManager;
public void Initialize()
{
InterfaceManager.Instance?.RegisterInterface<InputManager>(this);
}
public void InitializeData()
{
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
}
public void OnInputProvided(InputType inputType, float inputVal)
{
Debug.Log($"inputType: {inputType}, inputVal: {inputVal}");
switch (inputType)
{
case InputType.Accel:
case InputType.Rev:
gameplayManager.CarController.MoveInput(inputVal);
break;
// gameplayManager.CarController.MoveInput(inputVal);
// break;
case InputType.SteerLeft:
case InputType.SteerRight:
gameplayManager.CarController.SteerInput(inputVal);
break;
// gameplayManager.CarController.SteerInput(inputVal);
// break;
}
}
public void SetMoveInput(float val)
{
}
public void SetSteeringInput(float val)
{
}
}