|
|
|
@ -519,7 +519,7 @@ namespace Unity.BossRoom.Gameplay.UserInput
|
|
|
|
|
{
|
|
|
|
|
//IsPointerOverGameObject() is a simple way to determine if the mouse is over a UI element. If it is, we don't perform mouse input logic,
|
|
|
|
|
//to model the button "blocking" mouse clicks from falling through and interacting with the world.
|
|
|
|
|
|
|
|
|
|
bool isCharacterClicked = false;
|
|
|
|
|
if (Input.GetMouseButtonDown(1))
|
|
|
|
|
{
|
|
|
|
|
RequestAction(CharacterClass.Skill1.ActionID, SkillTriggerStyle.MouseClick);
|
|
|
|
@ -529,7 +529,6 @@ namespace Unity.BossRoom.Gameplay.UserInput
|
|
|
|
|
{
|
|
|
|
|
var ray = m_MainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition);
|
|
|
|
|
int hits = Physics.RaycastNonAlloc(ray, k_CachedHit, k_MouseInputRaycastDistance, m_ActionLayerMask);
|
|
|
|
|
|
|
|
|
|
if (hits > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < hits; i++)
|
|
|
|
@ -538,23 +537,21 @@ namespace Unity.BossRoom.Gameplay.UserInput
|
|
|
|
|
targetNetObj != m_ServerCharacter.NetworkObject)
|
|
|
|
|
{
|
|
|
|
|
// Check if the target is a valid ServerCharacter
|
|
|
|
|
if (!targetNetObj.TryGetComponent(out ServerCharacter targetCharacter))
|
|
|
|
|
if (targetNetObj.TryGetComponent(out ServerCharacter targetCharacter))
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("SwapAction failed: Target is not a valid ServerCharacter!");
|
|
|
|
|
return;
|
|
|
|
|
// Initiate the swap
|
|
|
|
|
targetCharacter.NotifySwapRequestRpc(m_ServerCharacter.NetworkObjectId);
|
|
|
|
|
Debug.Log($"Swap request sent to {targetCharacter.name}.");
|
|
|
|
|
isCharacterClicked = true;
|
|
|
|
|
break; // Exit the loop after initiating the swap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Notify the target player about the swap request
|
|
|
|
|
targetCharacter.NotifySwapRequestRpc(m_ServerCharacter.NetworkObjectId);
|
|
|
|
|
Debug.Log($"Swap request sent to {targetCharacter.name}.");
|
|
|
|
|
return; // Exit loop after sending the request
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if(Input.GetMouseButtonDown(0))
|
|
|
|
|
if(!isCharacterClicked && Input.GetMouseButtonDown(0))
|
|
|
|
|
{
|
|
|
|
|
m_MoveRequest = true; // Set move request for holding left-click
|
|
|
|
|
}
|
|
|
|
|