Ejemplo n.º 1
0
        public static void StartOnEngine(IEngine engine)
        {
            var loader           = ResourceCachedLoader.Instance;
            var darkFloorTexture = loader.GetSprite("./sprites/dark/floor.PNG");
            var darkCeilTexture  = loader.GetSprite("./sprites/dark/ceil.PNG");
            var darkWallTexture  = loader.GetSprite("./sprites/dark/wall.PNG");
            var wallTexture      = Sprite.Load("./sprites/wall2.png");
            var floorTexture     = Sprite.Load("./sprites/floor2.png");
            var ceilingTexture   = Sprite.Load("./sprites/ceiling2.png");
            var entranceTexture  = Sprite.Load("./sprites/dark/entrance.PNG");
            var doorAnimation    = loader.GetAnimation("./animations/door");
            var textureStorage   = new MapTextureStorage(
                darkFloorTexture,
                darkCeilTexture,
                darkWallTexture,
                floorTexture,
                wallTexture,
                ceilingTexture,
                entranceTexture,
                doorAnimation);

            var scene = SceneReader.ReadFromStrings(new[]
            {
                "$$$e$$$$$###############",
                "$P,,,,,,,..........D...#",
                "$$$$$$$$$###############",
            }, textureStorage.GetCellByChar, MathF.PI / 2);

            Trigger.AddTrigger(1, 15, scene =>
            {
                scene.Player.CurrentMonologue = new Monologue(new[]
                {
                    ("Вот и ты маг, что лишил нас магии ", 2000),
                    ("Маг, что изменил порядок планет", 2000),
                    ("Как бы там ни было много времени уже прошло", 2000),
                    ("Ты добился своей цели, переместил нашу планету дальше от солнца", 3000),
                    ("Тем самым лишил нас источника магии, и поддтолкнул к пути прогресса", 3000),
                    ("Но вот только ценой чего?", 3000),
                    ("В попытке переместить себя во времени, ты застрял, здесь в своей лаборатории", 3000),
                    ("Чтож, да крутиться тебе в этой петле времени в наказание за твое нахальство и наглость!", 3000),
                });
Ejemplo n.º 2
0
        public static void StartOnEngine(IEngine engine)
        {
            var resourceLoader = ResourceCachedLoader.Instance;
            var player         = new MyPlayer(new Vector2(2.0f, 2.0f), new Vector2(0.3f, 0.3f), MathF.PI / 2, 0);
            var wallTexture    = Sprite.Load("./sprites/greystone.png");
            var floorTexture   = Sprite.Load("./sprites/colorstone.png");
            var windowTexture  = Sprite.Load("./sprites/window.png");
            var ceilingTexture = Sprite.Load("./sprites/wood.png");
            var bedTexture     = Sprite.Load("./sprites/bed.png");
            var lichSprite     = Sprite.Load("./animations/lich/static/1.png");
            var sword          = Sword.Create(resourceLoader);
            var bow            = Bow.Create(resourceLoader);
            var doorAnimation  = resourceLoader.GetAnimation("./animations/door");

            player.Weapons = new Weapon[] { sword, bow };
            var backGroundMusic = resourceLoader.GetMusic(MusicResourceHelper.EnvironmentDungeonMusic);

            backGroundMusic.Play(-1);
            var storage = new MapTextureStorage(ceilingTexture, wallTexture, floorTexture, windowTexture, bedTexture, doorAnimation);
            var scene   = SceneReader.ReadFromStrings(
                new[]
            {
                "#################################################@@@@@@@",
                "#P..A#...#H.....R.R#........#......#.......M...R#@.AAA.@",
                "#....#...#.........#........#......#..z........A#@.HHH.@",
                "#.1..#...#a........##ooooooo#....g.#.........9.H#@.....@",
                "##d#######d##........z.....z.......#.....####d######d###",
                "#......#AHz@#......................#.R.R.#..........e..#",
                "#.z....oAMA@#......................#.....#.H@......@M..#",
                "#......#AHA@#.....ooo..............#..z..#........R....#",
                "#......#o###.....zo.oz.......%######.....#[email protected].#",
                "#......#..R#......ooo......p.d8...R......#...A..R......#",
                "#....z.....#.AA..............%######.....#............A#",
                "#......#############............o..#..z..#..@......@...#",
                "#.2....#.HHH..R.AAA#..........z.o..#A...H#..H........c.#",
                "##d###########d#######################.##############d##",
                "#.....z..AM#R.5..R..RH#.H..#######.............#.......#",
                "#........HA#.....o....#.......%M.....@...@.....#.......#",
                "#...@@.....#.....o....#....#.....@...@[email protected].#####",
                "#.z..@@....#..z..o...7d....#.....@R..@...@.....#.....R.#",
                "#.........3d.....o....#....o...................#.....f.#",
                "#.R.......H#....4....M#...R##########################d##",
                "############o###d###########@J......z........z.......z.#",
                "#.....H..............R#AAHH########..###################",
                "#..%.......R..........#....%...........#....M..........#",
                "#H......$........%R...#.............z..#.z....######..H#",
                "#.....................$.........AA.....#..#.....#RH#...#",
                "$R.......$.......oH..@#..z.............#..#..z..#..#.z.#",
                "######...............@#HMH.............#...........#RgR#",
                "@....#......$.........#$$$$$$$$.....z..#.z..#########d##",
                "@.HA.#......R........#$.AAAMMH$........#....#R...#.HH..@",
                "@@MA.d6..............#$.......$.......A##d###..z.#.zMM.@",
                "@.HAz#....@@@........#$.k....dl..........i.......oAAHHt@",
                "@@@@@###$##%###$##%###$$E$$$$$$$##################@@@@@@",
            }, storage.GetCellByChar, MathF.PI / 2);

            scene.Map.At(4, 2).SetTag("startDoor");
            Trigger.AddTrigger(new Vector2(2f, 3f), (scene) =>
            {
                Console.WriteLine("OPPEEEN THE DOOOOR");
                scene.Player.CurrentMonologue = new Monologue(
                    new[] {
                    ("Хмм... открыто", 2000)
                }
Ejemplo n.º 3
0
        public static void StartOnEngine(IEngine engine)
        {
            var wallTexture    = Sprite.Load("./sprites/greystone.png");
            var floorTexture   = Sprite.Load("./sprites/colorstone.png");
            var ceilingTexture = Sprite.Load("./sprites/wood.png");

            var startButtonTexture = Sprite.Load("./sprites/startbutton_v4.png");
            var exitButton         = Sprite.Load("./sprites/exitbutton_v1.png");
            var scoreboard         = Sprite.Load("./sprites/scoreboard.png");

            var directionText    = Sprite.Load("./sprites/direction.png");
            var controlsText     = Sprite.Load("./sprites/controls_v5.png");
            var statusBarInfo    = Sprite.Load("./sprites/statusbarinfo.png");
            var collectiblesText = Sprite.Load("./sprites/collectibles.png");
            var shootingTutorial = Sprite.Load("./sprites/shooting_tutorial.png");
            var fightingTutorial = Sprite.Load("./sprites/fight_tutorial.png");
            var magicTutorial    = Sprite.Load("./sprites/magic_tutorial.png");

            var doorAnimation = ResourceCachedLoader.Instance.GetAnimation("./animations/door");
            var storage       = new MapTextureStorage(ceilingTexture, wallTexture, floorTexture, controlsText,
                                                      startButtonTexture, exitButton, scoreboard, statusBarInfo, shootingTutorial, doorAnimation,
                                                      directionText, collectiblesText, fightingTutorial, magicTutorial);

            var scene = SceneReader.ReadFromStrings(
                new[]
            {
                "###############################",
                "#..........######.P.#.........#",
                "#..........#....d...d.........r",
                "#..........c....#...#.........#",
                "#..#########....##p##.........#",
                "#..#.A.M.H......#...#.........#",
                "#..l.....A......#...#.........#",
                "#..##d######i#n##...#.........s",
                "#..#....#...........#.........#",
                "#..#....#...........#.........#",
                "#..f.R..#...........#.........#",
                "#..##d###############.........#",
                "#..#....#.....H..A.#..........#",
                "#..#....d.......S..d..........e",
                "#..#.S..#.....H....#..........#",
                "#####m#########################"
            }, storage.GetCellByChar, 0);

            scene.AddObject(Note.Create(new Vector2(7.0f, 6.0f), "Просто записка.\nЧтобы закрыть нажмите ESC"));

            var map = scene.Map;

            map.At(2, 20).SetTag("tutorialDoor");
            Trigger.AddTrigger(new Vector2(19f, 2f),
                               (scene) => { Map.GetCellByTag("tutorialDoor").StartAnimatiom(() => { Map.GetCellByTag("tutorialDoor").Type = MapCellType.Empty; }); }, false);

            map.At(2, 16).SetTag("menuDoor");
            Trigger.AddTrigger(new Vector2(17f, 2f),
                               (scene) => Map.GetCellByTag("menuDoor")
                               .StartAnimatiom(() => Map.GetCellByTag("menuDoor").Type = MapCellType.Empty), false);

            map.At(7, 5).SetTag("shootingDoor");
            Trigger.AddTrigger(new Vector2(5f, 6f),
                               scene => Map.GetCellByTag("shootingDoor")
                               .StartAnimatiom(() => Map.GetCellByTag("shootingDoor").Type = MapCellType.Empty));

            map.At(11, 5).SetTag("fightingDoor");
            Trigger.AddTrigger(new Vector2(5f, 10f),
                               scene => Map.GetCellByTag("fightingDoor")
                               .StartAnimatiom(() => Map.GetCellByTag("fightingDoor").Type = MapCellType.Empty));

            map.At(13, 8).SetTag("magicDoor");
            Trigger.AddTrigger(new Vector2(7f, 13f),
                               scene => Map.GetCellByTag("magicDoor")
                               .StartAnimatiom(() => Map.GetCellByTag("magicDoor").Type = MapCellType.Empty));

            map.At(13, 19).SetTag("tutorialExit");
            Trigger.AddTrigger(new Vector2(18f, 13f),
                               scene => Map.GetCellByTag("tutorialExit")
                               .StartAnimatiom(() => Map.GetCellByTag("tutorialExit").Type = MapCellType.Empty));

            Trigger.AddTrigger(new Vector2(29f, 13f),
                               scene => Environment.Exit(0));

            Trigger.AddTrigger(new Vector2(29f, 7f),
                               scene =>
            {
                Map.ClearTags();
                Level1.Level1.StartOnEngine(engine);
            });

            var backGroundMusic = ResourceCachedLoader.Instance.GetMusic(MusicResourceHelper.EnvironmentDungeonMusic);

            backGroundMusic.Play(-1);

            while (engine.Update(scene))
            {
                if (scene.Player.Health <= 0)
                {
                    Map.ClearTags();
                    StartOnEngine(engine);
                }
            }
        }
Ejemplo n.º 4
0
        public static void StartOnEngine(IEngine engine)
        {
            var loader           = ResourceCachedLoader.Instance;
            var darkFloorTexture = loader.GetSprite("./sprites/dark/floor.PNG");
            var darkCeilTexture  = loader.GetSprite("./sprites/dark/ceil.PNG");
            var darkWallTexture  = loader.GetSprite("./sprites/dark/wall.PNG");
            var wallTexture      = Sprite.Load("./sprites/wall2.png");
            var floorTexture     = Sprite.Load("./sprites/floor2.png");
            var ceilingTexture   = Sprite.Load("./sprites/ceiling2.png");
            var entranceTexture  = Sprite.Load("./sprites/dark/entrance.PNG");
            var doorAnimation    = loader.GetAnimation("./animations/door");
            var textureStorage   = new MapTextureStorage(
                darkFloorTexture,
                darkCeilTexture,
                darkWallTexture,
                floorTexture,
                wallTexture,
                ceilingTexture,
                entranceTexture,
                doorAnimation);

            var scene = SceneReader.ReadFromStrings(new[]
            {
                "$$$e$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
                "$P,,H$,,,,,,,,,,,,$AH,,,,,,,,,,,,,,,$#$e$############$",
                "$,,,A$,,,,,,,,,,,,$AH,,,,,,,,,,,S,,,$#......##..R...#$",
                "$M$$$$,,,,,,,,,,,,$,,,,,,,,,,,,,,,,,$#....S.##......#$",
                "$,$,,,,,,,,,,,,,,,$$$$$$$$$$$$,,,,,,$#...#.........L#$",
                "$,$,,,,,,,,,,,,,,,,,,,,,,$HM$$d$,,$$$#S.......M.....#$",
                "$,$$$$$$$$$$$$$$$$$$$$$$$$$,,,,$,,$###......##......#$",
                "$,,,,,,,R,,,,,,,,,,,,,R,,,,,,,,$,,$##..##...##......#$",
                "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,,$#...##....########$",
                "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,,$#.....M..........#$",
                "$,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,$#####...##########$",
                "$,,,,R,,,,,,,,,,M,,,,,,,,S,,,,,,,,$##...............#$",
                "$,,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.###.............#$",
                "$,,$$##################################.............#$",
                "$$,,$$$MM,,,,,,,,,,.................................#$",
                "$$$,,,$$$$,H$RS$$$AA####################d############$",
                "$$$$$,,S,$$$$$$$$$$$$...HH..AA....S.#..#.#....#######$",
                "$,,$$$$,,,,,$$$,R,,,d.....S...MM..............#######$",
                "$,,,,,$$$$,,,M,,,$$$$################.........#######$",
                "$,,,,,,,,$$$$$$$$,,,,,,,,,,,,,,,,,,,###########,,,,,,$",
                "$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,$",
                "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
            }, textureStorage.GetCellByChar, MathF.PI / 2);

            // scene.AddObject(SpiderNet.Create());

            scene.AddObject(SpiderNet.Create(new Vector2(2.5f, 14.5f)));
            scene.AddObject(SpiderNet.Create(new Vector2(3.5f, 14.5f)));
            scene.AddObject(SpiderNet.Create(new Vector2(1.5f, 5.5f)));
            scene.AddObject(SpiderNet.Create(new Vector2(10.5f, 7.5f)));
            scene.AddObject(SpiderNet.Create(new Vector2(27.5f, 5.5f)));
            scene.AddObject(Mushrooms.Create(new Vector2(8.5f, 7.5f)));
            scene.AddObject(Mushrooms2.Create(new Vector2(12.5f, 7.5f)));
            scene.AddObject(Mushrooms2.Create(new Vector2(33.5f, 9.5f)));
            scene.AddObject(Lamp1.Create(new Vector2(15.5f, 7.5f)));
            scene.AddObject(Bones.Create(new Vector2(26.5f, 7.5f)));
            scene.AddObject(Bones.Create(new Vector2(26.5f, 3.5f)));
            scene.AddObject(Bones.Create(new Vector2(24.5f, 2.5f)));
            scene.AddObject(Bones.Create(new Vector2(2.5f, 10.5f)));
            scene.AddObject(Bones.Create(new Vector2(40.5f, 9.5f)));
            scene.AddObject(SpiderNet.Create(new Vector2(12.5f, 11.5f)));
            scene.AddObject(Bones.Create(new Vector2(16.5f, 10.5f)));
            scene.AddObject(Mushrooms.Create(new Vector2(22.5f, 1.5f)));
            scene.AddObject(SpiderNet.Create(new Vector2(35.5f, 1.5f)));

            scene.AddObject(
                Note.Create(new Vector2(37.5f - 18, 3.5f),
                            "Ещё одна запись в дневнике, я становлюсь одержимым?\n" +
                            "Этот ход через официальную лабораторию\n" +
                            "был неплохо спрятан от внешних глаз, но я осторожный\n" +
                            "Пожалуй, поставлю сюда какую-нибудь охрану.\n" +
                            "Желательно чтобы она не могла разболтать, что она охраняет."));

            scene.AddObject(
                Note.Create(new Vector2(40.5f, 18.5f),
                            "По моим последним данным - источник магии на планете - Солнце\n" +
                            "Многие бы отказались от своей идеи, имея такое препятствие.\n" +
                            "Многие, но не я.\n" +
                            "Мне повезло родиться могущественным волшебником. Даже очень.\n" +
                            "Одно из того, на что могут повлиять волшебники - гравитация.\n" +
                            "Через 2 года недалеко от нашей системы будет пролетать чёрная дыра\n" +
                            "Такой шанс выпадает раз в тысячу лет. Не воспользоваться - грех."));

            scene.AddObject(
                Note.Create(new Vector2(50.5f, 11.5f),
                            "Да, все расчёты верны!\n" +
                            "Небольшой манёвр поможет планете вырваться от нашего Солнца!\n" +
                            "Притянуты чёрной дырой мы не будем, а просто улетим с текущей орбиты\n" +
                            "Однако проблема - полёт займёт несколько десятков тысяч лет\n" +
                            "За столько лет вся разумная жизнь на планете вымрет\n" +
                            " \n" +
                            "Но и на это у меня есть ответ: заморозим время на планете в некоторой\n" +
                            "области, где укроются люди\n" +
                            "Главное, чтобы никто не мешал - никому не понравится такой полёт\n"));


            scene.AddObject(Lamp1.Create(new Vector2(36.5f, 17.5f)));
            scene.AddObject(Lamp1.Create(new Vector2(40.5f, 16.5f)));

            var music = loader.GetMusic(MusicResourceHelper.EnvironmentDungeonMusic);

            music.Play(-1);

            Trigger.AddTrigger(3, 1, (scene) =>
            {
                scene.Player.CurrentMonologue = new Monologue(new[]
                {
                    ("Пахнет крысами. Опять.", 3000)
                });