completed prototyping. Integrated abstraction layer from previous project. Refactored gameplay code. Found an issue with drifting and added a quick fix for the same. Added camera system for chasing player movement.
56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
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)
|
|
{
|
|
|
|
}
|
|
}
|