riversong code showcase
This commit is contained in:
38
Source/Riversong/Game/WorldGen/WorldCreationSystem.cs
Normal file
38
Source/Riversong/Game/WorldGen/WorldCreationSystem.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user