summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Entities/WorldBuilder.cs
blob: 7f033233a3647774060104b7441c11bdaa253a3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.Collections.Generic;
using MonoGame.Extended.Entities.Systems;

namespace MonoGame.Extended.Entities
{
    public class WorldBuilder
    {
        private readonly List<ISystem> _systems = new List<ISystem>();

        public WorldBuilder AddSystem(ISystem system)
        {
            _systems.Add(system);
            return this;
        }

        public World Build()
        {
            var world = new World();

            foreach (var system in _systems)
                world.RegisterSystem(system);

            return world;
        }
    }
}