/// <summary>
            /// Print running job counts for each aperture
            /// </summary>
            /// <param name="lens"></param>
            static void PrintRunningApertureJobCounts(IFocusLens lens)
            {
                string debugMessage = "Curring running Aperture Jobs:\n ===== \n";

                foreach ((int runningJobCount, string apertureName) in lens.getRunningJobCountPerAperture())
                {
                    debugMessage += $"{apertureName}: {runningJobCount}\n";
                }
                World.Debug.log(debugMessage);
            }
        /// <summary>
        /// Spawn a new player in and initialize their level focus
        /// </summary>
        /// <param name="newFocus"></param>
        void initilizePlayerFocus(ILevelFocus newFocus)
        {
            IFocusLens newLens = level.addPlayerFocus(newFocus);
            int        requiredControllerCount = newLens.initialize();

            // create the nodes the new lens will need to render
            for (int i = 0; i < requiredControllerCount; i++)
            {
                ChunkController chunkController = Instantiate(ChunkPrefab).GetComponent <ChunkController>();
                chunkController.gameObject.SetActive(false);
                chunkController.gameObject.name = $"Chunk #{++currentMaxChunkObjectID}#";
                chunkController.initalize(this);
                chunkController.transform.SetParent(transform);
                freeChunkControllerPool.Enqueue(chunkController);
            }

            // activate the new focus so it's being tracked
            newFocus.activate();
        }
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="level"></param>
        /// <param name="managedChunkRadius"></param>
        /// <param name="managedChunkHeight"></param>
        protected ChunkResolutionAperture(
            Chunk.Resolution resolution,
            IFocusLens lens,
            int managedChunkRadius,
            int managedChunkHeight          = 0,
            float yDistanceWeightMultiplier = 5.0f
            )
        {
            this.resolution          = resolution;
            this.lens                = lens;
            this.managedChunkRadius  = managedChunkRadius;
            YWeightMultiplier        = yDistanceWeightMultiplier;
            managedChunkHeightRadius = managedChunkHeight == 0 ? managedChunkRadius : managedChunkHeight;
            double distanceSquared       = Math.Pow(managedChunkRadius, 2);
            double distanceHeightSquared = Math.Pow(managedChunkHeightRadius, 2);

            MaxManagedChunkDistance = (int)Math.Sqrt(
                // a[a'^2 + b'^2] squared + b squared
                distanceSquared + distanceSquared + distanceHeightSquared
                );
        }
Example #4
0
 public MeshGenerationAperture(IFocusLens lens, int managedChunkRadius, int managedChunkHeight = 0)
     : base(Chunk.Resolution.Meshed, lens, managedChunkRadius, managedChunkHeight)
 {
 }
Example #5
0
 public VoxelDataLoadedAperture(IFocusLens lens, int managedChunkRadius, int managedChunkHeight = 0)
     : base(Chunk.Resolution.Loaded, lens, managedChunkRadius, managedChunkHeight)
 {
 }
 public ChunkVisibilityAperture(IFocusLens lens, int managedChunkRadius, int managedChunkHeight = 0)
     : base(Chunk.Resolution.Visible, lens, managedChunkRadius, managedChunkHeight)
 {
 }