private static void PrintActorSnapshots(ExampleScene scene, int time) { if (scene.Ball == null || scene.Cube == null) { return; } var ball = (RigidBodySnapshot)scene.Ball.Snapshot; var cube = (RigidBodySnapshot)scene.Cube.Snapshot; logger.Debug("Time: {0}ms. Cube position: {1}f, {2}f, {3}f", time, cube.Position.X, cube.Position.Y, cube.Position.Z); logger.Debug("Time: {0}ms. Ball position: {1}f, {2}f, {3}f", time, ball.Position.X, ball.Position.Y, ball.Position.Z); }
void Awake() { Serializer.Initialize(); clientId = new ClientId(1); simulator = new ClientSimulator(clientId); simulator.RegisterActorFactory <ExampleSceneDesc, ExampleScene>(desc => new ExampleScene()); simulator.RegisterActorFactory <BallDesc, Ball>(desc => new Ball()); simulator.RegisterActorFactory <CubeDesc, Cube>(desc => new Cube()); var sceneDesc = new ExampleSceneDesc(20, 50); scene = simulator.CreateScene <ExampleScene>(sceneDesc); client = new ReliableUdpClient(simulator, new IPEndPoint(IPAddress.Loopback, 9000)); client.Start(); }