2022-03-05 19:47:55 +01:00
|
|
|
using UnityEngine;
|
2022-08-08 15:55:27 +03:00
|
|
|
using UnityEngine.InputSystem;
|
2021-09-11 14:08:35 +02:00
|
|
|
|
2022-03-05 19:47:55 +01:00
|
|
|
public class BaseController : MonoBehaviour
|
2021-09-11 14:08:35 +02:00
|
|
|
{
|
2022-12-15 17:53:32 +02:00
|
|
|
protected BrainController _brainController;
|
|
|
|
|
protected Player _player;
|
|
|
|
|
protected PlayerMovement _playerMovement;
|
|
|
|
|
protected InputBuffer _inputBuffer;
|
|
|
|
|
protected PlayerInput _playerInput;
|
|
|
|
|
public Vector2Int InputDirection { get; set; }
|
|
|
|
|
public bool IsControllerEnabled { get; set; } = true;
|
2021-09-11 16:32:11 +02:00
|
|
|
|
2022-12-15 17:53:32 +02:00
|
|
|
void Awake()
|
|
|
|
|
{
|
|
|
|
|
_player = GetComponent<Player>();
|
|
|
|
|
_playerMovement = GetComponent<PlayerMovement>();
|
|
|
|
|
_brainController = GetComponent<BrainController>();
|
|
|
|
|
_inputBuffer = GetComponent<InputBuffer>();
|
|
|
|
|
_playerInput = GetComponent<PlayerInput>();
|
|
|
|
|
}
|
2022-08-30 22:54:45 +03:00
|
|
|
|
2022-12-15 17:53:32 +02:00
|
|
|
public virtual bool StandUp() { return false; }
|
|
|
|
|
public virtual bool Crouch() { return false; }
|
|
|
|
|
public virtual bool Jump() { return false; }
|
2022-05-27 11:30:04 +02:00
|
|
|
|
2022-12-15 17:53:32 +02:00
|
|
|
public virtual bool Dash(int direction) { return false; }
|
2021-09-11 14:08:35 +02:00
|
|
|
|
2022-12-15 17:53:32 +02:00
|
|
|
public virtual void SetEnable(bool state)
|
|
|
|
|
{
|
|
|
|
|
_playerInput.enabled = state;
|
|
|
|
|
}
|
2022-08-08 15:55:27 +03:00
|
|
|
|
2022-12-15 17:53:32 +02:00
|
|
|
public virtual void ActivateInput()
|
|
|
|
|
{
|
|
|
|
|
IsControllerEnabled = true;
|
|
|
|
|
}
|
2021-09-11 14:08:35 +02:00
|
|
|
|
2022-12-15 17:53:32 +02:00
|
|
|
public virtual void DeactivateInput()
|
|
|
|
|
{
|
|
|
|
|
IsControllerEnabled = false;
|
|
|
|
|
}
|
2021-09-11 14:08:35 +02:00
|
|
|
}
|