private void LoadNextMap(Screens.WorldPlay worldScreen) { worldScreen.SetActiveBoard(worldScreen.ImportZZTBoard(world.Boards[mapIndex]).Name); mapIndex++; if (mapIndex >= world.Boards.Length) { mapIndex = 0; } }
/// <summary> /// <c>test</c> /// </summary> private static void Init() { //SadConsole.Settings.gam.Window.Title = "DemoProject Core"; using var reader = System.IO.File.OpenRead("DEMO.ZZT"); var world = ZReader.ZWorld.Load(reader); var worldScreen = new Screens.WorldPlay(); GameHost.Instance.Screen = worldScreen; GameHost.Instance.DestroyDefaultStartingConsole(); worldScreen.SadComponents.Add(new KeyboardChangeBoard(world)); worldScreen.UseKeyboard = true; worldScreen.IsFocused = true; }
public override void ProcessMouse(IScreenObject host, MouseScreenObjectState state, out bool handled) { handled = false; WorldPlay world = (WorldPlay)host; state = new MouseScreenObjectState(world.GameBoard, state.Mouse); if (state.IsOnScreenObject) { if (state.Mouse.LeftButtonDown) { if (!world.GameBoard.GetObjectsAtPosition(state.CellPosition, out _)) { //world.GameBoard.PlayerControlledObject = obj; world.GameBoard.CreateGameObject(state.CellPosition, "pusher-east", Factories.GameObjectConfig.Empty); } } if (state.Mouse.RightClicked) { if (world.GameBoard.GetObjectsAtPosition(state.CellPosition, out var objects)) { if (objects[0].HasComponent <ObjectComponents.Pusher>()) { objects[0].RemoveComponent(objects[0].GetComponent <ObjectComponents.Pusher>()); } var pusher = new ObjectComponents.Pusher(); pusher.Direction = Direction.Types.Down; objects[0].AddComponent(pusher); } } handled = true; } }