public Game(Context ctx) { this.ctx = ctx; state = GameState.UNDEFINED; systems = new GameSystems(); systems.Add(new AnimSystem()); systems.Add(new MovementSystem()); systems.Add(new MapSystem(ctx.config.Get <MapSystemConfig>())); systems.Add(new CameraSystem()); systems.Add(new EntitySystem()); systems.Init(systems, ctx); ActionSystem actionSys = new ActionSystem(assemblyNames: "Game"); actionSys.OnActionSystemRegistered += iActionSystem => { if (iActionSystem is IGameSystem gs) { gs.Init(systems, ctx); } }; actionSys.RegisterSystems(); MapSystem mapSystem = systems.Get <MapSystem>(); mapSystem.Load(new[] { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xB, 0xB, 0xB, 0xB, 0x1000A, 0xB, 0xB, 0xB, 0x1, 0x1, 0x1, 0x1, 0xB, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xB, 0x1, 0x1, 0x1, 0x1, 0xB, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xB, 0x1, 0x1, 0x1, 0x1, 0xB, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xB, 0x1, 0x1, 0x1, 0x1, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, }, 12, "Entrance"); player = systems.Get <EntitySystem>().CreatePlayer("Player"); int spawnpoint = mapSystem.Map.Spawnpoint; player.SetLocalPosition(mapSystem.Map.IndexToWorldPos(spawnpoint)); ctx.eventPump.Dispatch(); // systems.Get<CameraSystem>().SetTarget(player.transform); }
private void InitComponents() { gameSystems.Init(); }
/// <summary> /// 初始化各个系统 /// </summary> private void InitSystems() { _gameSystems.Init(GameStartFinished); }