Skip to content

Commit edc03c3

Browse files
committed
Fixed whitepsace issue
1 parent 427f609 commit edc03c3

File tree

1 file changed

+38
-25
lines changed

1 file changed

+38
-25
lines changed

Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ public class ClientInputSender : NetworkBehaviour
2323
//upstream network conservation. This matters when holding down your mouse button to move.
2424
const float k_MoveSendRateSeconds = 0.04f; //25 fps.
2525

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

2830
float m_LastSentMove;
2931

@@ -39,8 +41,7 @@ public class ClientInputSender : NetworkBehaviour
3941

4042
RaycastHitComparer m_RaycastHitComparer;
4143

42-
[SerializeField]
43-
ServerCharacter m_ServerCharacter;
44+
[SerializeField] ServerCharacter m_ServerCharacter;
4445

4546
/// <summary>
4647
/// This event fires at the time when an action request is sent to the server.
@@ -53,12 +54,12 @@ public class ClientInputSender : NetworkBehaviour
5354
/// </summary>
5455
public enum SkillTriggerStyle
5556
{
56-
None, //no skill was triggered.
57-
MouseClick, //skill was triggered via mouse-click implying you should do a raycast from the mouse position to find a target.
58-
Keyboard, //skill was triggered via a Keyboard press, implying target should be taken from the active target.
57+
None, //no skill was triggered.
58+
MouseClick, //skill was triggered via mouse-click implying you should do a raycast from the mouse position to find a target.
59+
Keyboard, //skill was triggered via a Keyboard press, implying target should be taken from the active target.
5960
KeyboardRelease, //represents a released key.
60-
UI, //skill was triggered from the UI, and similar to Keyboard, target should be inferred from the active target.
61-
UIRelease, //represents letting go of the mouse-button on a UI button
61+
UI, //skill was triggered from the UI, and similar to Keyboard, target should be inferred from the active target.
62+
UIRelease, //represents letting go of the mouse-button on a UI button
6263
}
6364

6465
bool IsReleaseStyle(SkillTriggerStyle style)
@@ -105,8 +106,7 @@ struct ActionRequest
105106
/// </summary>
106107
CharacterClass CharacterClass => m_ServerCharacter.CharacterClass;
107108

108-
[SerializeField]
109-
PhysicsWrapper m_PhysicsWrapper;
109+
[SerializeField] PhysicsWrapper m_PhysicsWrapper;
110110

111111
public ActionState actionState1 { get; private set; }
112112

@@ -140,11 +140,13 @@ public override void OnNetworkSpawn()
140140
{
141141
actionState1 = new ActionState() { actionID = action1.ActionID, selectable = true };
142142
}
143+
143144
if (CharacterClass.Skill2 &&
144145
GameDataSource.Instance.TryGetActionPrototypeByID(CharacterClass.Skill2.ActionID, out var action2))
145146
{
146147
actionState2 = new ActionState() { actionID = action2.ActionID, selectable = true };
147148
}
149+
148150
if (CharacterClass.Skill3 &&
149151
GameDataSource.Instance.TryGetActionPrototypeByID(CharacterClass.Skill3.ActionID, out var action3))
150152
{
@@ -225,16 +227,19 @@ void FixedUpdate()
225227
}
226228
else if (!IsReleaseStyle(m_ActionRequests[i].TriggerStyle))
227229
{
228-
var actionPrototype = GameDataSource.Instance.GetActionPrototypeByID(m_ActionRequests[i].RequestedActionID);
230+
var actionPrototype =
231+
GameDataSource.Instance.GetActionPrototypeByID(m_ActionRequests[i].RequestedActionID);
229232
if (actionPrototype.Config.ActionInput != null)
230233
{
231234
var skillPlayer = Instantiate(actionPrototype.Config.ActionInput);
232-
skillPlayer.Initiate(m_ServerCharacter, m_PhysicsWrapper.Transform.position, actionPrototype.ActionID, SendInput, FinishSkill);
235+
skillPlayer.Initiate(m_ServerCharacter, m_PhysicsWrapper.Transform.position,
236+
actionPrototype.ActionID, SendInput, FinishSkill);
233237
m_CurrentSkillInput = skillPlayer;
234238
}
235239
else
236240
{
237-
PerformSkill(actionPrototype.ActionID, m_ActionRequests[i].TriggerStyle, m_ActionRequests[i].TargetId);
241+
PerformSkill(actionPrototype.ActionID, m_ActionRequests[i].TriggerStyle,
242+
m_ActionRequests[i].TargetId);
238243
}
239244
}
240245
}
@@ -354,7 +359,8 @@ void PerformSkill(ActionID actionID, SkillTriggerStyle triggerStyle, ulong targe
354359
/// <param name="triggerStyle">How did this skill play get triggered? Mouse, Keyboard, UI etc.</param>
355360
/// <param name="resultData">Out parameter that will be filled with the resulting action, if any.</param>
356361
/// <returns>true if we should play an action, false otherwise. </returns>
357-
bool GetActionRequestForTarget(Transform hit, ActionID actionID, SkillTriggerStyle triggerStyle, out ActionRequestData resultData)
362+
bool GetActionRequestForTarget(Transform hit, ActionID actionID, SkillTriggerStyle triggerStyle,
363+
out ActionRequestData resultData)
358364
{
359365
resultData = new ActionRequestData();
360366

@@ -427,7 +433,8 @@ void PopulateSkillRequest(Vector3 hitPoint, ActionID actionID, ref ActionRequest
427433
//for projectile logic, infer the direction from the click position.
428434
case ActionLogic.LaunchProjectile:
429435
resultData.Direction = direction;
430-
resultData.ShouldClose = false; //why? Because you could be lining up a shot, hoping to hit other people between you and your target. Moving you would be quite invasive.
436+
resultData.ShouldClose =
437+
false; //why? Because you could be lining up a shot, hoping to hit other people between you and your target. Moving you would be quite invasive.
431438
return;
432439
case ActionLogic.Melee:
433440
resultData.Direction = direction;
@@ -475,13 +482,13 @@ void Update()
475482
{
476483
if (Input.GetKeyDown(KeyCode.Alpha1) && CharacterClass.Skill1)
477484
{
478-
479485
RequestAction(actionState1.actionID, SkillTriggerStyle.Keyboard);
480486
}
481487
else if (Input.GetKeyUp(KeyCode.Alpha1) && CharacterClass.Skill1)
482488
{
483489
RequestAction(actionState1.actionID, SkillTriggerStyle.KeyboardRelease);
484490
}
491+
485492
if (Input.GetKeyDown(KeyCode.Alpha2) && CharacterClass.Skill2)
486493
{
487494
RequestAction(actionState2.actionID, SkillTriggerStyle.Keyboard);
@@ -490,6 +497,7 @@ void Update()
490497
{
491498
RequestAction(actionState2.actionID, SkillTriggerStyle.KeyboardRelease);
492499
}
500+
493501
if (Input.GetKeyDown(KeyCode.Alpha3) && CharacterClass.Skill3)
494502
{
495503
RequestAction(actionState3.actionID, SkillTriggerStyle.Keyboard);
@@ -503,14 +511,17 @@ void Update()
503511
{
504512
RequestAction(GameDataSource.Instance.Emote1ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
505513
}
514+
506515
if (Input.GetKeyDown(KeyCode.Alpha6))
507516
{
508517
RequestAction(GameDataSource.Instance.Emote2ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
509518
}
519+
510520
if (Input.GetKeyDown(KeyCode.Alpha7))
511521
{
512522
RequestAction(GameDataSource.Instance.Emote3ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
513523
}
524+
514525
if (Input.GetKeyDown(KeyCode.Alpha8))
515526
{
516527
RequestAction(GameDataSource.Instance.Emote4ActionPrototype.ActionID, SkillTriggerStyle.Keyboard);
@@ -528,7 +539,8 @@ void Update()
528539

529540
if (Input.GetMouseButtonDown(0))
530541
{
531-
RequestAction(GameDataSource.Instance.GeneralTargetActionPrototype.ActionID, SkillTriggerStyle.MouseClick);
542+
RequestAction(GameDataSource.Instance.GeneralTargetActionPrototype.ActionID,
543+
SkillTriggerStyle.MouseClick);
532544
}
533545
else if (Input.GetMouseButton(0))
534546
{
@@ -540,7 +552,8 @@ void Update()
540552
void UpdateAction1()
541553
{
542554
var isHoldingNetworkObject =
543-
NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(m_ServerCharacter.HeldNetworkObject.Value,
555+
NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(
556+
m_ServerCharacter.HeldNetworkObject.Value,
544557
out var heldNetworkObject);
545558

546559
NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(m_ServerCharacter.TargetId.Value,
@@ -554,19 +567,19 @@ void UpdateAction1()
554567
actionState1.actionID = GameDataSource.Instance.DropActionPrototype.ActionID;
555568
}
556569
else if ((m_ServerCharacter.TargetId.Value != 0
557-
&& selection != null
558-
&& selection.TryGetComponent(out PickUpState pickUpState))
559-
)
570+
&& selection != null
571+
&& selection.TryGetComponent(out PickUpState pickUpState))
572+
)
560573
{
561574
// special case: targeting a pickup-able item or holding a pickup object
562575

563576
actionState1.actionID = GameDataSource.Instance.PickUpActionPrototype.ActionID;
564577
}
565578
else if (m_ServerCharacter.TargetId.Value != 0
566-
&& selection != null
567-
&& selection.NetworkObjectId != m_ServerCharacter.NetworkObjectId
568-
&& selection.TryGetComponent(out ServerCharacter charState)
569-
&& !charState.IsNpc)
579+
&& selection != null
580+
&& selection.NetworkObjectId != m_ServerCharacter.NetworkObjectId
581+
&& selection.TryGetComponent(out ServerCharacter charState)
582+
&& !charState.IsNpc)
570583
{
571584
// special case: when we have a player selected, we change the meaning of the basic action
572585
// we have another player selected! In that case we want to reflect that our basic Action is a Revive, not an attack!

0 commit comments

Comments
 (0)