예제 #1
0
    private IEnumerator SetupMap()
    {
        yield return(new WaitForFixedUpdate());

        Level3D.GetComponent <MapGenerator>().BakeNavMeshes();

        yield return(Spawner.Setup());

        yield return(new WaitForFixedUpdate());

        Player3DTransform.gameObject.GetComponent <NavMeshAgent>().isStopped = true;
    }
예제 #2
0
        /// <summary>
        /// Generates a 3D level with the given chunk library and level.
        /// </summary>
        /// <param name="chunkLibrary">
        /// Chunk library that holds all chunk templates to use for the level generation.
        /// </param>
        /// <param name="level">Level to fill during the level generation process.</param>
        public void GenerateLevel(ChunkLibrary3D chunkLibrary, Level3D level)
        {
            Random2 random = new Random2();

            this.GenerateLevel(chunkLibrary, level, random);
        }
예제 #3
0
 /// <summary>
 /// Adds a random chunk to the passed level at a random position,
 /// without checking for any intersections with the level bounds or
 /// other chunks and without aligning it to any other chunk.
 /// </summary>
 /// <param name="chunkLibrary">
 /// Chunk library that holds all chunk templates to use for the level generation.
 /// </param>
 /// <param name="level">Level to fill during the level generation process.</param>
 /// <param name="random">Random number generator to use for the level generation.</param>
 public void AddRandomChunk(ChunkLibrary3D chunkLibrary, Level3D level, Random2 random)
 {
     this.AddRandomChunk<ChunkTemplate3D, Chunk3D>(chunkLibrary, level, random);
 }
예제 #4
0
 /// <summary>
 ///   Expands the passed level at any free context.
 /// </summary>
 /// <param name="chunkLibrary">
 /// Chunk library that holds all chunk templates to use for the level generation.
 /// </param>
 /// <param name="level">Level to fill during the level generation process.</param>
 /// <param name="random">Random number generator to use for the level generation.</param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="chunkLibrary"/>, <paramref name="level"/> or <paramref name="random"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="chunkLibrary"/> is empty, or the types of <paramref name="chunkLibrary"/> and <paramref name="level"/> don't match.
 /// </exception>
 /// <returns>
 ///   <c>true</c>, if another chunk can be added to the level, and
 ///   <c>false</c>, otherwise.
 /// </returns>
 public bool AddChunk(ChunkLibrary3D chunkLibrary, Level3D level, Random2 random)
 {
     return this.AddChunk<ChunkTemplate3D, Chunk3D>(chunkLibrary, level, random);
 }
예제 #5
0
 /// <summary>
 ///   Expands the passed level at the specified free context.
 /// </summary>
 /// <param name="chunkLibrary">
 /// Chunk library that holds all chunk templates to use for the level generation.
 /// </param>
 /// <param name="level">Level to fill during the level generation process.</param>
 /// <param name="random">Random number generator to use for the level generation.</param>
 /// <param name="freeContext">Context to expland the level at.</param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="chunkLibrary"/>, <paramref name="level"/> or <paramref name="random"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="chunkLibrary"/> is empty, or the types of <paramref name="chunkLibrary"/> and <paramref name="level"/> don't match.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="freeContext"/> is already blocked or aligned.
 /// </exception>
 /// <returns>
 ///   <c>true</c>, if another chunk can be added to the level, and
 ///   <c>false</c>, otherwise.
 /// </returns>
 public bool AddChunk(ChunkLibrary3D chunkLibrary, Level3D level, Random2 random, Context3D freeContext)
 {
     return this.AddChunk<ChunkTemplate3D, Chunk3D>(chunkLibrary, level, random, freeContext);
 }
예제 #6
0
 /// <summary>
 ///   Applies all available post-processing policies to the passed level.
 /// </summary>
 /// <param name="level">Level to process.</param>
 public void PostProcessLevel(Level3D level)
 {
     this.PostProcessLevel<Chunk3D>(level);
 }
예제 #7
0
        /// <summary>
        /// Generates a 3D level with the given chunk library, desired dimensions for the level and random number generator.
        /// </summary>
        /// <param name="chunkLibrary">
        /// Chunk library that holds all chunk templates to use for the level generation.
        /// </param>
        /// <param name="levelExtents">Width, height and depth the resulting level should have.</param>
        /// <param name="random">Random number generator to use for the level generation.</param>
        /// <returns>Generated level with the desired width, height and depth.</returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Level width, height or depth is smaller than or equal to zero.
        /// </exception>
        public Level3D GenerateLevel(ChunkLibrary3D chunkLibrary, Vector3F levelExtents, Random2 random)
        {
            if (levelExtents.X <= 0f)
            {
                throw new ArgumentOutOfRangeException("levelExtents", "Level width must be greater than zero.");
            }

            if (levelExtents.Y <= 0f)
            {
                throw new ArgumentOutOfRangeException("levelExtents", "Level height must be greater than zero.");
            }

            if (levelExtents.Z <= 0f)
            {
                throw new ArgumentOutOfRangeException("levelExtents", "Level depth must be greater than zero.");
            }

            Level3D level = new Level3D(levelExtents);

            this.GenerateLevel(chunkLibrary, level, random);

            return level;
        }
예제 #8
0
 /// <summary>
 /// Generates a 3D level with the given chunk library, level and random number generator.
 /// </summary>
 /// <param name="chunkLibrary">
 /// Chunk library that holds all chunk templates to use for the level generation.
 /// </param>
 /// <param name="level">Level to fill during the level generation process.</param>
 /// <param name="random">Random number generator to use for the level generation.</param>
 public void GenerateLevel(ChunkLibrary3D chunkLibrary, Level3D level, Random2 random)
 {
     this.GenerateLevel<ChunkTemplate3D, Chunk3D>(chunkLibrary, level, random);
 }