protected override void OnStartRunning() { // Retrieve Scene camera & associated Entity camera = Camera.main; Entities.ForEach((Entity e, ref CameraControlComponent control) => { cameraControl = control; }); // Retrieve & cache player Tank entities if (playersQuery.CalculateLength() == 0) { throw new InvalidOperationException("No tank player entities detected"); } var players = playersQuery.ToEntityArray(Allocator.TempJob); { ComponentDataFromEntity <TankPlayer> tankPlayers = GetComponentDataFromEntity <TankPlayer>(); for (int i = 0; i < players.Length; i++) { TankPlayer tankPlayer = tankPlayers[players[i]]; if (tankPlayer.PlayerId == 0) { player1Entity = players[i]; } else if (tankPlayer.PlayerId == 1) { player2Entity = players[i]; } } players.Dispose(); } }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var camera = GetComponent <Camera>(); var data = new CameraControlComponent { DampTime = m_DampTime, MinSize = m_MinSize, ScreenEdgeBuffer = m_ScreenEdgeBuffer, CameraAspect = camera.aspect, CameraSize = camera.orthographicSize, ZoomSpeed = m_ZoomSpeed }; dstManager.AddComponentData(entity, data); }