@@ -24,7 +24,7 @@ public class ClientInputSender : NetworkBehaviour
2424 //upstream network conservation. This matters when holding down your mouse button to move.
2525 const float k_MoveSendRateSeconds = 0.04f ; //25 fps.
2626
27- const float k_TargetMoveTimeout = 0.45f ; //prevent moves for this long after targeting someone (helps prevent walking to the guy you clicked).
27+ const float k_TargetMoveTimeout = 0.45f ; //prevent moves for this long after targeting someone (helps prevent walking to the guy you clicked).
2828
2929 float m_LastSentMove ;
3030
@@ -75,12 +75,12 @@ public class ClientInputSender : NetworkBehaviour
7575 /// </summary>
7676 public enum SkillTriggerStyle
7777 {
78- None , //no skill was triggered.
79- MouseClick , //skill was triggered via mouse-click implying you should do a raycast from the mouse position to find a target.
80- Keyboard , //skill was triggered via a Keyboard press, implying target should be taken from the active target.
78+ None , //no skill was triggered.
79+ MouseClick , //skill was triggered via mouse-click implying you should do a raycast from the mouse position to find a target.
80+ Keyboard , //skill was triggered via a Keyboard press, implying target should be taken from the active target.
8181 KeyboardRelease , //represents a released key.
82- UI , //skill was triggered from the UI, and similar to Keyboard, target should be inferred from the active target.
83- UIRelease , //represents letting go of the mouse-button on a UI button
82+ UI , //skill was triggered from the UI, and similar to Keyboard, target should be inferred from the active target.
83+ UIRelease , //represents letting go of the mouse-button on a UI button
8484 }
8585
8686 bool IsReleaseStyle ( SkillTriggerStyle style )
@@ -150,6 +150,7 @@ public override void OnNetworkSpawn()
150150 if ( ! IsClient || ! IsOwner )
151151 {
152152 enabled = false ;
153+
153154 // dont need to do anything else if not the owner
154155 return ;
155156 }
@@ -162,17 +163,19 @@ public override void OnNetworkSpawn()
162163 {
163164 actionState1 = new ActionState ( ) { actionID = action1 . ActionID , selectable = true } ;
164165 }
166+
165167 if ( CharacterClass . Skill2 &&
166168 GameDataSource . Instance . TryGetActionPrototypeByID ( CharacterClass . Skill2 . ActionID , out var action2 ) )
167169 {
168170 actionState2 = new ActionState ( ) { actionID = action2 . ActionID , selectable = true } ;
169171 }
172+
170173 if ( CharacterClass . Skill3 &&
171174 GameDataSource . Instance . TryGetActionPrototypeByID ( CharacterClass . Skill3 . ActionID , out var action3 ) )
172175 {
173176 actionState3 = new ActionState ( ) { actionID = action3 . ActionID , selectable = true } ;
174177 }
175-
178+
176179 m_Action1 . action . started += OnAction1Started ;
177180 m_Action1 . action . canceled += OnAction1Canceled ;
178181 m_Action2 . action . started += OnAction2Started ;
@@ -202,7 +205,7 @@ public override void OnNetworkDespawn()
202205 {
203206 m_TargetServerCharacter . NetLifeState . LifeState . OnValueChanged -= OnTargetLifeStateChanged ;
204207 }
205-
208+
206209 m_Action1 . action . started -= OnAction1Started ;
207210 m_Action1 . action . canceled -= OnAction1Canceled ;
208211 m_Action2 . action . started -= OnAction2Started ;
@@ -468,7 +471,7 @@ void PopulateSkillRequest(Vector3 hitPoint, ActionID actionID, ref ActionRequest
468471 //there is a bug where the direction is flipped if the hitPos and current position are almost the same,
469472 //so we use the character's direction instead.
470473 float directionLength = offset . magnitude ;
471- Vector3 direction = 1.0f /*epsilon*/ <= directionLength ? ( offset / directionLength ) : m_PhysicsWrapper . Transform . forward ;
474+ Vector3 direction = 1.0f /*epsilon*/ <= directionLength ? ( offset / directionLength ) : m_PhysicsWrapper . Transform . forward ;
472475
473476 switch ( actionConfig . Logic )
474477 {
@@ -518,52 +521,52 @@ public void RequestAction(ActionID actionID, SkillTriggerStyle triggerStyle, ulo
518521 m_ActionRequestCount ++ ;
519522 }
520523 }
521-
524+
522525 void OnAction1Started ( InputAction . CallbackContext obj )
523526 {
524527 RequestAction ( actionState1 . actionID , SkillTriggerStyle . Keyboard ) ;
525528 }
526-
529+
527530 void OnAction1Canceled ( InputAction . CallbackContext obj )
528531 {
529532 RequestAction ( actionState1 . actionID , SkillTriggerStyle . KeyboardRelease ) ;
530533 }
531-
534+
532535 void OnAction2Started ( InputAction . CallbackContext obj )
533536 {
534537 RequestAction ( actionState2 . actionID , SkillTriggerStyle . Keyboard ) ;
535538 }
536-
539+
537540 void OnAction2Canceled ( InputAction . CallbackContext obj )
538541 {
539542 RequestAction ( actionState2 . actionID , SkillTriggerStyle . KeyboardRelease ) ;
540543 }
541-
544+
542545 void OnAction3Started ( InputAction . CallbackContext obj )
543546 {
544547 RequestAction ( actionState3 . actionID , SkillTriggerStyle . Keyboard ) ;
545548 }
546-
549+
547550 void OnAction3Canceled ( InputAction . CallbackContext obj )
548551 {
549552 RequestAction ( actionState3 . actionID , SkillTriggerStyle . KeyboardRelease ) ;
550553 }
551-
554+
552555 void OnAction5Performed ( InputAction . CallbackContext obj )
553556 {
554557 RequestAction ( GameDataSource . Instance . Emote1ActionPrototype . ActionID , SkillTriggerStyle . Keyboard ) ;
555558 }
556-
559+
557560 void OnAction6Performed ( InputAction . CallbackContext obj )
558561 {
559562 RequestAction ( GameDataSource . Instance . Emote2ActionPrototype . ActionID , SkillTriggerStyle . Keyboard ) ;
560563 }
561-
564+
562565 void OnAction7Performed ( InputAction . CallbackContext obj )
563566 {
564567 RequestAction ( GameDataSource . Instance . Emote3ActionPrototype . ActionID , SkillTriggerStyle . Keyboard ) ;
565568 }
566-
569+
567570 void OnAction8Performed ( InputAction . CallbackContext obj )
568571 {
569572 RequestAction ( GameDataSource . Instance . Emote4ActionPrototype . ActionID , SkillTriggerStyle . Keyboard ) ;
@@ -580,7 +583,7 @@ void Update()
580583 {
581584 RequestAction ( CharacterClass . Skill1 . ActionID , SkillTriggerStyle . MouseClick ) ;
582585 }
583-
586+
584587 if ( m_TargetAction . action . WasPressedThisFrame ( ) )
585588 {
586589 RequestAction ( GameDataSource . Instance . GeneralTargetActionPrototype . ActionID , SkillTriggerStyle . MouseClick ) ;
@@ -609,19 +612,19 @@ void UpdateAction1()
609612 actionState1 . actionID = GameDataSource . Instance . DropActionPrototype . ActionID ;
610613 }
611614 else if ( ( m_ServerCharacter . TargetId . Value != 0
612- && selection != null
613- && selection . TryGetComponent ( out PickUpState pickUpState ) )
614- )
615+ && selection != null
616+ && selection . TryGetComponent ( out PickUpState pickUpState ) )
617+ )
615618 {
616619 // special case: targeting a pickup-able item or holding a pickup object
617620
618621 actionState1 . actionID = GameDataSource . Instance . PickUpActionPrototype . ActionID ;
619622 }
620623 else if ( m_ServerCharacter . TargetId . Value != 0
621- && selection != null
622- && selection . NetworkObjectId != m_ServerCharacter . NetworkObjectId
623- && selection . TryGetComponent ( out ServerCharacter charState )
624- && ! charState . IsNpc )
624+ && selection != null
625+ && selection . NetworkObjectId != m_ServerCharacter . NetworkObjectId
626+ && selection . TryGetComponent ( out ServerCharacter charState )
627+ && ! charState . IsNpc )
625628 {
626629 // special case: when we have a player selected, we change the meaning of the basic action
627630 // 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