Skip to content

Commit

Permalink
whitespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fernando-cortez committed Jan 16, 2025
1 parent 75c748c commit 7dce6f2
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 43 deletions.
3 changes: 2 additions & 1 deletion Assets/Scripts/Gameplay/Action/Input/AoeActionInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AoeActionInput : BaseActionInput

[SerializeField]
GameObject m_OutOfRangeVisualization;

[SerializeField]
InputActionReference m_PointAction;

Expand Down Expand Up @@ -82,6 +82,7 @@ void Update()
};
m_SendInput(data);
}

Destroy(gameObject);
return;
}
Expand Down
10 changes: 7 additions & 3 deletions Assets/Scripts/Gameplay/DebugCheats/DebugCheatsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public class DebugCheatsManager : NetworkBehaviour
[SerializeField]
[Tooltip("Boss to spawn. Make sure this is included in the NetworkManager's list of prefabs!")]
NetworkObject m_BossPrefab;

[SerializeField]
InputActionReference m_ToggleCheatsAction;

SwitchedDoor m_SwitchedDoor;

SwitchedDoor SwitchedDoor
Expand All @@ -43,6 +43,7 @@ SwitchedDoor SwitchedDoor
{
m_SwitchedDoor = FindAnyObjectByType<SwitchedDoor>();
}

return m_SwitchedDoor;
}
}
Expand Down Expand Up @@ -160,7 +161,6 @@ void ServerKillTargetRpc(RpcParams serverRpcParams = default)
UnityEngine.Debug.Log($"Target {targetId} has no IDamageable component or cannot be damaged.");
}
}

}
}

Expand All @@ -177,6 +177,7 @@ void ServerKillAllEnemiesRpc(RpcParams serverRpcParams = default)
}
}
}

PublishCheatUsedMessage(serverRpcParams.Receive.SenderClientId, "KillAllEnemies");
}

Expand Down Expand Up @@ -211,6 +212,7 @@ void ServerHealPlayerRpc(RpcParams serverRpcParams = default)
damageable.ReceiveHP(null, baseHp);
}
}

PublishCheatUsedMessage(serverRpcParams.Receive.SenderClientId, "HealPlayer");
}
}
Expand All @@ -227,6 +229,7 @@ void ServerToggleSuperSpeedRpc(RpcParams serverRpcParams = default)
break;
}
}

PublishCheatUsedMessage(clientId, "ToggleSuperSpeed");
}

Expand All @@ -242,6 +245,7 @@ void ServerToggleTeleportModeRpc(RpcParams serverRpcParams = default)
break;
}
}

PublishCheatUsedMessage(serverRpcParams.Receive.SenderClientId, "ToggleTeleportMode");
}

Expand Down
10 changes: 7 additions & 3 deletions Assets/Scripts/Gameplay/UI/HeroActionBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,23 @@ void RegisterInputSender(ClientPlayerAvatar clientPlayerAvatar)
{
GameDataSource.Instance.TryGetActionPrototypeByID(m_InputSender.actionState1.actionID, out action1);
}

UpdateActionButton(m_ButtonInfo[ActionButtonType.BasicAction], action1);

Action action2 = null;
if (m_InputSender.actionState2 != null)
{
GameDataSource.Instance.TryGetActionPrototypeByID(m_InputSender.actionState2.actionID, out action2);
}

UpdateActionButton(m_ButtonInfo[ActionButtonType.Special1], action2);

Action action3 = null;
if (m_InputSender.actionState3 != null)
{
GameDataSource.Instance.TryGetActionPrototypeByID(m_InputSender.actionState3.actionID, out action3);
}

UpdateActionButton(m_ButtonInfo[ActionButtonType.Special2], action3);
}

Expand All @@ -165,6 +168,7 @@ void DeregisterInputSender()
{
m_InputSender.action1ModifiedCallback -= Action1ModifiedCallback;
}

m_InputSender = null;
}

Expand All @@ -177,7 +181,7 @@ void Awake()
[ActionButtonType.Special2] = new ActionButtonInfo(ActionButtonType.Special2, m_SpecialAction2Button, this),
[ActionButtonType.EmoteBar] = new ActionButtonInfo(ActionButtonType.EmoteBar, m_EmoteBarButton, this),
};

m_ToggleEmoteBarAction.action.performed += OnToggleEmoteBarPerformed;

ClientPlayerAvatar.LocalClientSpawned += RegisterInputSender;
Expand All @@ -203,13 +207,13 @@ void OnDisable()
void OnDestroy()
{
DeregisterInputSender();

m_ToggleEmoteBarAction.action.performed -= OnToggleEmoteBarPerformed;

ClientPlayerAvatar.LocalClientSpawned -= RegisterInputSender;
ClientPlayerAvatar.LocalClientDespawned -= DeregisterInputSender;
}

void OnToggleEmoteBarPerformed(InputAction.CallbackContext obj)
{
if (obj.performed)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Gameplay/UI/UITooltipDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class UITooltipDetector : MonoBehaviour, IPointerEnterHandler, IPointerEx
{
[SerializeField]
InputActionReference m_PointAction;

[SerializeField]
[Tooltip("The actual Tooltip that should be triggered")]
UITooltipPopup m_TooltipPopup;
Expand Down
57 changes: 30 additions & 27 deletions Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ClientInputSender : NetworkBehaviour
//upstream network conservation. This matters when holding down your mouse button to move.
const float k_MoveSendRateSeconds = 0.04f; //25 fps.

const float k_TargetMoveTimeout = 0.45f; //prevent moves for this long after targeting someone (helps prevent walking to the guy you clicked).
const float k_TargetMoveTimeout = 0.45f; //prevent moves for this long after targeting someone (helps prevent walking to the guy you clicked).

float m_LastSentMove;

Expand Down Expand Up @@ -75,12 +75,12 @@ public class ClientInputSender : NetworkBehaviour
/// </summary>
public enum SkillTriggerStyle
{
None, //no skill was triggered.
MouseClick, //skill was triggered via mouse-click implying you should do a raycast from the mouse position to find a target.
Keyboard, //skill was triggered via a Keyboard press, implying target should be taken from the active target.
None, //no skill was triggered.
MouseClick, //skill was triggered via mouse-click implying you should do a raycast from the mouse position to find a target.
Keyboard, //skill was triggered via a Keyboard press, implying target should be taken from the active target.
KeyboardRelease, //represents a released key.
UI, //skill was triggered from the UI, and similar to Keyboard, target should be inferred from the active target.
UIRelease, //represents letting go of the mouse-button on a UI button
UI, //skill was triggered from the UI, and similar to Keyboard, target should be inferred from the active target.
UIRelease, //represents letting go of the mouse-button on a UI button
}

bool IsReleaseStyle(SkillTriggerStyle style)
Expand Down Expand Up @@ -150,6 +150,7 @@ public override void OnNetworkSpawn()
if (!IsClient || !IsOwner)
{
enabled = false;

// dont need to do anything else if not the owner
return;
}
Expand All @@ -162,17 +163,19 @@ public override void OnNetworkSpawn()
{
actionState1 = new ActionState() { actionID = action1.ActionID, selectable = true };
}

if (CharacterClass.Skill2 &&
GameDataSource.Instance.TryGetActionPrototypeByID(CharacterClass.Skill2.ActionID, out var action2))
{
actionState2 = new ActionState() { actionID = action2.ActionID, selectable = true };
}

if (CharacterClass.Skill3 &&
GameDataSource.Instance.TryGetActionPrototypeByID(CharacterClass.Skill3.ActionID, out var action3))
{
actionState3 = new ActionState() { actionID = action3.ActionID, selectable = true };
}

m_Action1.action.started += OnAction1Started;
m_Action1.action.canceled += OnAction1Canceled;
m_Action2.action.started += OnAction2Started;
Expand Down Expand Up @@ -202,7 +205,7 @@ public override void OnNetworkDespawn()
{
m_TargetServerCharacter.NetLifeState.LifeState.OnValueChanged -= OnTargetLifeStateChanged;
}

m_Action1.action.started -= OnAction1Started;
m_Action1.action.canceled -= OnAction1Canceled;
m_Action2.action.started -= OnAction2Started;
Expand Down Expand Up @@ -468,7 +471,7 @@ void PopulateSkillRequest(Vector3 hitPoint, ActionID actionID, ref ActionRequest
//there is a bug where the direction is flipped if the hitPos and current position are almost the same,
//so we use the character's direction instead.
float directionLength = offset.magnitude;
Vector3 direction = 1.0f/*epsilon*/ <= directionLength ? (offset / directionLength) : m_PhysicsWrapper.Transform.forward;
Vector3 direction = 1.0f /*epsilon*/ <= directionLength ? (offset / directionLength) : m_PhysicsWrapper.Transform.forward;

switch (actionConfig.Logic)
{
Expand Down Expand Up @@ -518,52 +521,52 @@ public void RequestAction(ActionID actionID, SkillTriggerStyle triggerStyle, ulo
m_ActionRequestCount++;
}
}

void OnAction1Started(InputAction.CallbackContext obj)
{
RequestAction(actionState1.actionID, SkillTriggerStyle.Keyboard);
}

void OnAction1Canceled(InputAction.CallbackContext obj)
{
RequestAction(actionState1.actionID, SkillTriggerStyle.KeyboardRelease);
}

void OnAction2Started(InputAction.CallbackContext obj)
{
RequestAction(actionState2.actionID, SkillTriggerStyle.Keyboard);
}

void OnAction2Canceled(InputAction.CallbackContext obj)
{
RequestAction(actionState2.actionID, SkillTriggerStyle.KeyboardRelease);
}

void OnAction3Started(InputAction.CallbackContext obj)
{
RequestAction(actionState3.actionID, SkillTriggerStyle.Keyboard);
}

void OnAction3Canceled(InputAction.CallbackContext obj)
{
RequestAction(actionState3.actionID, SkillTriggerStyle.KeyboardRelease);
}

void OnAction5Performed(InputAction.CallbackContext obj)
{
RequestAction(GameDataSource.Instance.Emote1ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
}

void OnAction6Performed(InputAction.CallbackContext obj)
{
RequestAction(GameDataSource.Instance.Emote2ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
}

void OnAction7Performed(InputAction.CallbackContext obj)
{
RequestAction(GameDataSource.Instance.Emote3ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
}

void OnAction8Performed(InputAction.CallbackContext obj)
{
RequestAction(GameDataSource.Instance.Emote4ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
Expand All @@ -580,7 +583,7 @@ void Update()
{
RequestAction(CharacterClass.Skill1.ActionID, SkillTriggerStyle.MouseClick);
}

if (m_TargetAction.action.WasPressedThisFrame())
{
RequestAction(GameDataSource.Instance.GeneralTargetActionPrototype.ActionID, SkillTriggerStyle.MouseClick);
Expand Down Expand Up @@ -609,19 +612,19 @@ void UpdateAction1()
actionState1.actionID = GameDataSource.Instance.DropActionPrototype.ActionID;
}
else if ((m_ServerCharacter.TargetId.Value != 0
&& selection != null
&& selection.TryGetComponent(out PickUpState pickUpState))
)
&& selection != null
&& selection.TryGetComponent(out PickUpState pickUpState))
)
{
// special case: targeting a pickup-able item or holding a pickup object

actionState1.actionID = GameDataSource.Instance.PickUpActionPrototype.ActionID;
}
else if (m_ServerCharacter.TargetId.Value != 0
&& selection != null
&& selection.NetworkObjectId != m_ServerCharacter.NetworkObjectId
&& selection.TryGetComponent(out ServerCharacter charState)
&& !charState.IsNpc)
&& selection != null
&& selection.NetworkObjectId != m_ServerCharacter.NetworkObjectId
&& selection.TryGetComponent(out ServerCharacter charState)
&& !charState.IsNpc)
{
// special case: when we have a player selected, we change the meaning of the basic action
// we have another player selected! In that case we want to reflect that our basic Action is a Revive, not an attack!
Expand Down
Loading

0 comments on commit 7dce6f2

Please sign in to comment.