diff --git a/Game/Behaviours/PaddleBehaviour.cs b/Game/Behaviours/PaddleBehaviour.cs index 82e732a..391316f 100644 --- a/Game/Behaviours/PaddleBehaviour.cs +++ b/Game/Behaviours/PaddleBehaviour.cs @@ -12,7 +12,7 @@ using Syntriax.Engine.Network.Abstract; namespace Pong.Behaviours; -public class PaddleBehaviour(Keys Up, Keys Down, float High, float Low, float Speed) : NetworkBehaviour +public class PaddleBehaviour(Keys Up, Keys Down, float High, float Low, float Speed) : BehaviourOverride { private Keys Up { get; } = Up; private Keys Down { get; } = Down; @@ -41,20 +41,13 @@ public class PaddleBehaviour(Keys Up, Keys Down, float High, float Low, float Sp private void MovePaddle(Vector2D vectorToAdd) { - if (!LocalAssigned && !IsServer) - return; - GameObject.Transform.Position += vectorToAdd; - - NetDataWriter dataWriter = communicator.GetMessageWriter(this); - dataWriter.Put(Transform.Position); - communicator.Manager.SendToAll(dataWriter, LiteNetLib.DeliveryMethod.Unreliable); } protected override void OnFirstActiveFrame() { - if (!BehaviourController.TryGetBehaviour>(out var behaviourResult)) - inputs = behaviourResult ?? BehaviourController.AddBehaviour(); + BehaviourController.TryGetBehaviour>(out var behaviourResult); + inputs = behaviourResult ?? throw new Exception($"{nameof(IButtonInputs)} is missing on {GameObject.Name}."); if (!GameObject.GameManager.TryFindBehaviour(out INetworkCommunicator? foundCommunicator)) throw new Exception($"{nameof(INetworkCommunicator)} is missing on GameManager.");