refactor: string id to IConnection parameters for sending network packets
This commit is contained in:
@@ -32,7 +32,7 @@ public class BallBehaviour : Behaviour2D, IFirstFrameUpdate, IPhysicsUpdate, INe
|
||||
{
|
||||
ResetBall();
|
||||
RigidBody.Velocity = launchDirection * Speed;
|
||||
networkServer?.SendToClient("*", new BallUpdatePacket(this));
|
||||
networkServer?.SendToAll(new BallUpdatePacket(this));
|
||||
}
|
||||
|
||||
public void ResetBall()
|
||||
@@ -41,7 +41,7 @@ public class BallBehaviour : Behaviour2D, IFirstFrameUpdate, IPhysicsUpdate, INe
|
||||
tweenManager.CancelTween(networkTween);
|
||||
Transform.Position = Vector2D.Zero;
|
||||
RigidBody.Velocity = Vector2D.Zero;
|
||||
networkServer?.SendToClient("*", new BallResetPacket());
|
||||
networkServer?.SendToAll(new BallResetPacket());
|
||||
}
|
||||
|
||||
public void PhysicsUpdate(float delta)
|
||||
@@ -59,7 +59,7 @@ public class BallBehaviour : Behaviour2D, IFirstFrameUpdate, IPhysicsUpdate, INe
|
||||
RigidBody.Velocity = information.Detected.Transform.Position.FromTo(information.Detector.Transform.Position).Normalized * RigidBody.Velocity.Magnitude;
|
||||
else
|
||||
RigidBody.Velocity = RigidBody.Velocity.Reflect(information.Normal);
|
||||
networkServer?.SendToClient("*", new BallUpdatePacket(this));
|
||||
networkServer?.SendToAll(new BallUpdatePacket(this));
|
||||
}
|
||||
|
||||
public BallBehaviour() { }
|
||||
|
@@ -75,7 +75,7 @@ public class PaddleBehaviour(Keys Up, Keys Down, float High, float Low, float Sp
|
||||
isUpPressed = packet.IsUpPressed;
|
||||
isDownPressed = packet.IsDownPressed;
|
||||
|
||||
networkServer?.SendToClient("*", new PaddleKeyStatePacket(this));
|
||||
networkServer?.SendToAll(new PaddleKeyStatePacket(this));
|
||||
}
|
||||
|
||||
public void OnClientPacketArrived(IConnection sender, PaddleKeyStatePacket packet)
|
||||
|
Reference in New Issue
Block a user