|
|
|
@ -480,10 +480,17 @@ namespace Unity.BossRoom.Gameplay.UserInput
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
HandleSwapInput();
|
|
|
|
|
HandleAbilityInput();
|
|
|
|
|
HandleMovementInput();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HandleSwapInput()
|
|
|
|
|
{
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Q))
|
|
|
|
|
{
|
|
|
|
|
if (!m_AbilitySystem.IsAbilityModeActive() && m_ServerCharacter.IsOnAPlatform && !m_ServerCharacter.IsCrow) // Prevent swap mode if ability mode is active
|
|
|
|
|
if (CanActivateSwapMode())
|
|
|
|
|
{
|
|
|
|
|
ToggleSwapMode();
|
|
|
|
|
}
|
|
|
|
@ -492,59 +499,60 @@ namespace Unity.BossRoom.Gameplay.UserInput
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Not on a platform or not a player");
|
|
|
|
|
Debug.Log("Cannot activate swap mode while ability mode is active.");
|
|
|
|
|
}
|
|
|
|
|
} //Swap
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.E)) //Dash'N'Crash
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool CanActivateSwapMode()
|
|
|
|
|
{
|
|
|
|
|
if (!IsSwapModeActive) // Prevent ability mode if swap mode is active
|
|
|
|
|
return !m_AbilitySystem.IsAbilityModeActive() && m_ServerCharacter.IsOnAPlatform && !m_ServerCharacter.IsCrow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HandleAbilityInput()
|
|
|
|
|
{
|
|
|
|
|
if (m_ServerCharacter.IsCrow) // Ensure only the crow can activate the ability
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash
|
|
|
|
|
{
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Activated Ability mode");
|
|
|
|
|
m_AbilitySystem.ActivateAbilityByKey(GameDataSource.Instance.DashNCrashAbilityKey);
|
|
|
|
|
ActivateAbilityIfAllowed(GameDataSource.Instance.DashNCrashAbilityKey, "Abilities are only for crow");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.R)) // Freeze Throw
|
|
|
|
|
{
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Abilities are only for crow");
|
|
|
|
|
Debug.Log("You must be the Crow to activate this ability.");
|
|
|
|
|
}
|
|
|
|
|
ActivateAbilityIfAllowed(GameDataSource.Instance.FreezeThrowAbilityKey);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.F)) // Vector Wall
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Cannot activate ability mode while swap mode is active.");
|
|
|
|
|
ActivateAbilityIfAllowed(GameDataSource.Instance.VectorWallAbilityKey);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.R)) //Freeze Throw
|
|
|
|
|
{
|
|
|
|
|
if (!IsSwapModeActive) // Prevent ability mode if swap mode is active
|
|
|
|
|
|
|
|
|
|
private void ActivateAbilityIfAllowed(string abilityKey, string errorMessage = null)
|
|
|
|
|
{
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Activated Ability mode");
|
|
|
|
|
m_AbilitySystem.ActivateAbilityByKey(GameDataSource.Instance.FreezeThrowAbilityKey);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (IsSwapModeActive)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Cannot activate ability mode while swap mode is active.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.F)) //Vector Wall
|
|
|
|
|
|
|
|
|
|
if (abilityKey == GameDataSource.Instance.DashNCrashAbilityKey && !m_ServerCharacter.IsCrow)
|
|
|
|
|
{
|
|
|
|
|
if (!IsSwapModeActive) // Prevent ability mode if swap mode is active
|
|
|
|
|
if (errorMessage != null)
|
|
|
|
|
{
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Activated Ability mode");
|
|
|
|
|
m_AbilitySystem.ActivateAbilityByKey(GameDataSource.Instance.VectorWallAbilityKey);
|
|
|
|
|
m_UIMessageFeed.DisplayMessage(errorMessage);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Cannot activate ability mode while swap mode is active.");
|
|
|
|
|
Debug.Log("You must be the Crow to activate this ability.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Activated Ability mode");
|
|
|
|
|
m_AbilitySystem.ActivateAbilityByKey(abilityKey);
|
|
|
|
|
}
|
|
|
|
|
if (m_AbilitySystem.IsAbilityModeActive()) return;
|
|
|
|
|
if (!IsSwapModeActive) // Prevent other inputs if swap mode is active
|
|
|
|
|
|
|
|
|
|
private void HandleMovementInput()
|
|
|
|
|
{
|
|
|
|
|
if (Input.GetMouseButtonDown(1))
|
|
|
|
|
if (Input.GetMouseButtonDown(1)) // Right-click for movement
|
|
|
|
|
{
|
|
|
|
|
m_MoveRequest = true;
|
|
|
|
|
}
|
|
|
|
|
CancelActiveModes();
|
|
|
|
|
m_MoveRequest = true; // Accept movement request
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!EventSystem.current.IsPointerOverGameObject() && m_CurrentSkillInput == null)
|
|
|
|
|
{
|
|
|
|
|
if (IsSwapModeActive && Input.GetMouseButtonDown(0)) // Left-click to request swap
|
|
|
|
@ -554,6 +562,24 @@ namespace Unity.BossRoom.Gameplay.UserInput
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CancelActiveModes()
|
|
|
|
|
{
|
|
|
|
|
if (m_AbilitySystem.IsAbilityModeActive())
|
|
|
|
|
{
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Ability mode canceled.");
|
|
|
|
|
m_AbilitySystem.DeactivateAbilityMode();
|
|
|
|
|
Debug.Log("Ability mode deactivated due to move request.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IsSwapModeActive)
|
|
|
|
|
{
|
|
|
|
|
m_UIMessageFeed.DisplayMessage("Swap mode canceled.");
|
|
|
|
|
ToggleSwapMode();
|
|
|
|
|
Debug.Log("Swap mode deactivated due to move request.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Toggles swap mode on or off.
|
|
|
|
|
/// </summary>
|
|
|
|
|