public void SetUp() { GameSceneFactory gameSceneFactory = new GameSceneFactory(); Scene matchScene = gameSceneFactory.Create(); ArrangeTransformSystem[] arrangeCollidersSystems = { new WithHpArrangeTransformSystem(contexts) }; PhysicsRollbackManager physicsRollbackManager = new PhysicsRollbackManager(arrangeCollidersSystems); PhysicsVelocityManager physicsVelocityManager = new PhysicsVelocityManager(); PhysicsRotationManager physicsRotationManager = new PhysicsRotationManager(); SnapshotFactory snapshotFactory = new SnapshotFactory(contexts.serverGame); playerPredictor = new PlayerPredictor(physicsRollbackManager, matchScene, contexts.serverGame, physicsVelocityManager, physicsRotationManager, snapshotFactory); playerEntity = contexts.serverGame.CreateEntity(); ClientPrefabsStorage clientPrefabsStorage = new ClientPrefabsStorage(); GameObject warshipPrefab = clientPrefabsStorage.GetPrefab(ViewTypeEnum.StarSparrow1); GameObject go = Object.Instantiate(warshipPrefab, Vector3.zero, Quaternion.identity); SceneManager.MoveGameObjectToScene(go, matchScene); ushort playerEntityId = 100; playerEntity.AddId(playerEntityId); playerEntity.AddView(go); playerEntity.AddRigidbody(go.GetComponent <Rigidbody>()); LogAssert.ignoreFailingMessages = true; }
private void AddNewObject(ushort id, ViewTransformCompressed viewTransform) { ServerGameEntity gameEntity = gameContext.CreateEntity(); gameEntity.AddId(id); gameEntity.AddViewType(viewTransform.viewTypeEnum); Quaternion quaternion = Quaternion.AngleAxis(viewTransform.Angle, Vector3.up); gameEntity.AddSpawnTransform(viewTransform.GetPosition(), quaternion); }