コード例 #1
0
        public void BiomeGridTestSimplePasses()
        {
            GridGenerator biomeGridGenerator = new BiomeGridGenerator();

            Assert.False(biomeGridGenerator.IsIncreaseGrid(0));
            Assert.False(biomeGridGenerator.IsIncreaseGrid(-1));
            List <Vector2> terestPositions = biomeGridGenerator.GenerateGridEdgesTest();

            Assert.AreEqual(new Vector2(-1 * biomeGridGenerator.gridBoxSize, -1 * biomeGridGenerator.gridBoxSize), terestPositions[0]);
            Assert.AreEqual(new Vector2(0, biomeGridGenerator.gridBoxSize), terestPositions.Last());
            Assert.True(terestPositions.Contains(new Vector2(-1 * biomeGridGenerator.gridBoxSize + biomeGridGenerator.gridBoxSize, -1 * biomeGridGenerator.gridBoxSize)));


            Assert.False(biomeGridGenerator.IsIncreaseGrid(10));
            Assert.True(biomeGridGenerator.IsIncreaseGrid(biomeGridGenerator.gridBoxSize * biomeGridGenerator.gridBoxSize + 1));



            // Use the Assert class to test conditions
        }
コード例 #2
0
 public void OnUpdate()
 {
     if (IsChunkToSpawn())
     {
         chunkGenerator.GenerateChunk(setOfChunks, visibleChunks, player.currentChunk, player.transform.position, camer.rangeCamera);
     }
     if (biomeGridGenerator.IsIncreaseGrid(Vector2.Distance(player.transform.position, Vector3.zero)))
     {
         biomeGridGenerator.GenerateGridEdges();
     }
 }