void Start() { _systems = CreateSystems(_contexts, _services); _systems.Initialize(); _contexts.game.isMainGameScreen = true; _contexts.level.ReplaceLevelId(0); var level = _services.level.CreateLevel(); var player = _services.gameEntity.CreatePlayer(); player.ReplacePosition(GameBoardElementPosition.Create(level.level.id, 0, 0)); for (var i = 0; i < 1; i++) { var npc = _services.gameEntity.CreateNpc(); npc.ReplacePosition(GameBoardElementPosition.Create(level.level.id, 1, 1)); } for (var i = 0; i < 10000; i++) { var npc = _services.gameEntity.CreateInvisibleNpc(); npc.ReplacePosition(GameBoardElementPosition.Create(level.level.id, 1, 1)); } }
protected override void Execute(List <GameEntity> entities) { foreach (var entity in entities) { var position = entity.position.value; var targetPosition = entity.moveAction.targetPosition; entity.ReplacePosition(GameBoardElementPosition.Create(position.levelId, targetPosition.x, targetPosition.y)); } }
private void AddMoveCommand(IntVector2 direction) { foreach (var entity in _interactiveEntities) { var position = entity.position.value; var targetPosition = GameBoardElementPosition.Create(position.levelId, position.x + direction.x, position.y + direction.y); if (targetPosition != null) { entity.ReplaceMoveCommand(direction, targetPosition); } } }
private void GenerateLevel(LevelEntity levelEntity) { var level = levelEntity.level; for (var x = 0; x < level.columns; x++) { for (var y = 0; y < level.rows; y++) { var tile = _game.CreateEntity(); tile.isTile = true; tile.AddPosition(GameBoardElementPosition.Create(level.id, x, y)); tile.AddFloor("dirt"); tile.AddAsset("GameBoardElement"); // entity.AddAsciiSprite("DejaVuSansMono_2"); tile.AddAsciiSprite("dot"); tile.isVisible = true; } } levelEntity.isUngeneratedLevel = false; }
public void Execute() { foreach (var entity in _entities) { var position = entity.position.value; var level = _levelContext.GetEntityWithLevel(position.levelId).level; var x = GetRandomPosition(position.x, level.columns); var y = GetRandomPosition(position.x, level.rows); entity.ReplaceMoveCommand(new IntVector2(x - position.x, y - position.y), GameBoardElementPosition.Create(position.levelId, x, y)); } }