コード例 #1
0
    /// End of variable declaration
    ///
    ///

    void Start()
    {
        if (!DebuggingMode)
        {
            InitializeDatapaths();
        }

        //Initialize a bunch of stuff
        NewChunkPos = new Vector2(Mathf.Floor(Player.position.x / SimulatedChunkSize), Mathf.Floor(Player.position.z / SimulatedChunkSize));
        OldChunkPos = NewChunkPos;
        if (!DebuggingMode)
        {
            worldCreator.Execute();
        }
        PlayerBody   = Player.GetComponent <Rigidbody>();
        worldManager = new WorldManager(worldCreator, biomes, subBiome);
        worldManager.BiomeTransitionSmoothing = BiomeTransitionSmoothing;
        PlayerBlockPos = new Vector3(Mathf.Floor(Player.transform.position.x), Mathf.Floor(Player.transform.position.y), Mathf.Floor(Player.transform.position.z));

        //Preparing the world
        ChunkList = new List <Chunk>();
        for (int y = -Mathf.CeilToInt(LOD4EndChunkDistance); y <= Mathf.Ceil(LOD4EndChunkDistance); y++)
        {
            for (int x = -Mathf.CeilToInt(LOD4EndChunkDistance); x <= Mathf.Ceil(LOD4EndChunkDistance); x++)
            {
                float Distance = Vector2.Distance(Vector2.zero, new Vector2(x, y));

                if (Distance < LOD4EndChunkDistance)
                {
                    MaxChunkAllowed++;

                    /*ChunkList.Insert(0,new Chunk(new Vector2(NewChunkPos.x+x,NewChunkPos.y+y),DistanceToLOD(Distance),SimulatedChunkSize,worldTextures,worldManager,MeshTemplate,false));
                     * //ChunkList[0].PrepareGeneration();
                     * //ChunkList[0].GenerateWorldObject();*/
                }
            }
        }
    }