update Input new in script
This commit is contained in:
@@ -60,6 +60,10 @@ namespace OnlyScove.Scripts
|
||||
public virtual Vector2 ScrollInput { get; protected set; }
|
||||
public virtual bool IsSprintHeld { get; protected set; }
|
||||
public virtual bool IsAttackHeld { get; protected set; }
|
||||
|
||||
|
||||
public bool IsAimHeld { get; protected set; }
|
||||
public bool IsBlockHeld { get; protected set; }
|
||||
|
||||
public void ApplyNetworkInput(Vector2 move, bool isSprint)
|
||||
{
|
||||
@@ -77,6 +81,10 @@ namespace OnlyScove.Scripts
|
||||
public event Action OnNextInteractEvent;
|
||||
public event Action OnPreviousInteractEvent;
|
||||
public event Action OnToggleViewEvent;
|
||||
|
||||
public event Action OnReloadEvent;
|
||||
public event Action OnStrongAttackEvent;
|
||||
public event Action OnSwitchSideEvent;
|
||||
|
||||
// UI Events
|
||||
public event Action OnToggleSettingsEvent; // Cho Ctrl+O
|
||||
@@ -185,5 +193,30 @@ namespace OnlyScove.Scripts
|
||||
OnCancelEvent?.Invoke();
|
||||
}
|
||||
}
|
||||
public void OnAim(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed) IsAimHeld = true;
|
||||
if (context.canceled) IsAimHeld = false;
|
||||
}
|
||||
public void OnBlock(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed) IsBlockHeld = true;
|
||||
if (context.canceled) IsBlockHeld = false;
|
||||
}
|
||||
|
||||
public void OnStrongAttack(InputAction.CallbackContext context)
|
||||
{
|
||||
if(context.performed) OnStrongAttackEvent?.Invoke();
|
||||
}
|
||||
|
||||
public void OnReload(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed) OnReloadEvent?.Invoke();
|
||||
}
|
||||
|
||||
public void OnSwitchSide(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed) OnSwitchSideEvent?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user