Ejemplo n.º 1
0
        private void InitializePlayerView()
        {
            #region PlayerView Camera

            var playerViewQuery = GetEntityQuery(typeof(PlayerViewTag), typeof(Camera));

            if (playerViewQuery.IsEmpty)
            {
                LogNotFound("Camera, PlayerViewTag");
                return;
            }

            var playerViewEntities = playerViewQuery.ToEntityArray(Allocator.Temp);

            var playerViewEntity = playerViewEntities[0]; // Get first (anyway it's only one atm)

            #endregion

            #region Map Boundaries

            var boundariesQuery = GetEntityQuery(typeof(MapBoundariesData));

            if (boundariesQuery.IsEmpty)
            {
                LogNotFound("MapBoundariesData");
                return;
            }

            var mapBoundaries = boundariesQuery.ToEntityArray(Allocator.Temp)[0];

            #endregion

            boundaries = EntityManager.GetComponentData <MapBoundariesData>(mapBoundaries);

            playerView = EntityManager.GetComponentObject <Camera>(playerViewEntity);
        }