Files
riversong-code-showcase/Source/Riversong/Game/WorldGen/WorldCreationSystem.cs
2026-05-21 16:04:49 +02:00

38 lines
1.1 KiB
C#

using System;
using Unity.Mathematics;
using UnityEngine;
using IServiceProvider = DanieleMarotta.RiversongCodeShowcase.IServiceProvider;
namespace DanieleMarotta.RiversongCodeShowcase
{
[GameSystemGroup(typeof(WorldGenSystemGroup))]
public class WorldCreationSystem : GameSystem, IServiceProvider, IDisposable
{
private World _world;
public WorldCreationSystem(IServiceLocator serviceLocator) : base(serviceLocator)
{
}
public void RegisterServices(IServiceLocator serviceLocator)
{
_world = new World();
_world.Size = int2.zero;
_world.Heightmap = new WorldHeightmap(int2.zero);
_world.BlockMap = new BlockMap(int2.zero);
_world.Fertility = new FertilityMap(int2.zero);
_world.WaterMap = new WaterMap(int2.zero);
_world.EntityIdMap = new EntityIdMap(int2.zero);
_world.RoadNetwork = new RoadNetwork(int2.zero);
ServiceLocator.RegisterService(_world);
}
public void Dispose()
{
_world.Dispose();
Debug.Log("World disposed");
}
}
}