Ejemplo n.º 1
0
        public static void SetWorldId(Vector3 position, int id)
        {
            if (position.y < 0f || position.y > height - 1)
            {
                return;
            }

            Chunk chunk = Find(position);

            if (chunk != null && chunk.initialized)
            {
                Vector3 chunkPosition = chunk.transform.position;

                int x = Mathf.FloorToInt(position.x - chunkPosition.x);
                int y = Mathf.FloorToInt(position.y - chunkPosition.y);
                int z = Mathf.FloorToInt(position.z - chunkPosition.z);

                chunk.SetLocalId(x, y, z, id);
            }
            else
            {
                Debug.LogWarning("This chunk has not been initialized yet!");
            }
        }