Esempio n. 1
0
        public static Lich Create(ResourceCachedLoader loader, Vector2 position, float direction)
        {
            var staticAnimation   = loader.GetAnimation("./animations/lich/static");
            var deadAnimation     = loader.GetAnimation("./animations/lich/dead");
            var shootingAnimation = loader.GetAnimation("./animations/lich/shooting");
            var runningAnimation  = loader.GetAnimation("./animations/lich/running");
            var fireBallAnimation = loader.GetAnimation("./animations/fireball/moving");
            var fireBallBlowing   = loader.GetAnimation("./animations/fireball/blow");
            var fireBallBlowSound = loader.GetSound(MusicResourceHelper.FireBallBlowPath);
            var laugh             = loader.GetSound(MusicResourceHelper.LichEvilLaughPath);
            var deathSound        = loader.GetSound(MusicResourceHelper.LichDeadPath);
            var size = new Vector2(0.3f, 0.3f);

            return(new Lich(
                       position, size, direction,
                       staticAnimation,
                       deadAnimation,
                       shootingAnimation,
                       runningAnimation,
                       fireBallAnimation,
                       fireBallBlowing,
                       fireBallBlowSound,
                       laugh,
                       deathSound));
        }
Esempio n. 2
0
        public static Skeleton Create(ResourceCachedLoader loader, Vector2 position, float directionAngle)
        {
            var staticAnimation = loader.GetAnimation("./animations/skeleton/guard_right");
            var followingAndBlockingAnimation = loader.GetAnimation("./animations/skeleton/moving");
            var attackRightAnimation          = loader.GetAnimation("./animations/skeleton/right_attack");
            var attackLeftAnimation           = loader.GetAnimation("./animations/skeleton/left_attack");
            var blockRightAnimation           = loader.GetAnimation("./animations/skeleton/guard_right");
            var blockLeftAnimation            = loader.GetAnimation("./animations/skeleton/guard_left");
            var size       = new Vector2(0.3f, 0.3f);
            var dead       = loader.GetAnimation("./animations/skeleton/dead");
            var deathSound = loader.GetSound(MusicResourceHelper.SkeletonDeadPath);
            var hitSound   = loader.GetSound(MusicResourceHelper.SkeletonHit);
            var shieldHit  = loader.GetSound(MusicResourceHelper.SkeletonShieldHit);

            return(new Skeleton(
                       staticAnimation,
                       followingAndBlockingAnimation,
                       attackRightAnimation,
                       attackLeftAnimation,
                       blockRightAnimation,
                       blockLeftAnimation,
                       position,
                       size,
                       directionAngle,
                       dead,
                       deathSound,
                       hitSound,
                       shieldHit));
        }
Esempio n. 3
0
        public static Bow Create(ResourceCachedLoader loader)
        {
            var @static     = loader.GetAnimation("./animations/bow_static");
            var moving      = loader.GetAnimation("./animations/bow_moving");
            var shoot       = loader.GetAnimation("./animations/bow_shoot");
            var arrowSprite = loader.GetSprite("./sprites/arrow.png");
            var shootSound  = loader.GetSound(MusicResourceHelper.BowShootSoundPath);

            return(new Bow(
                       @static,
                       moving,
                       shoot,
                       arrowSprite,
                       shootSound));
        }
Esempio n. 4
0
        public static Sword Create(ResourceCachedLoader loader)
        {
            var @static     = loader.GetAnimation("./animations/sword_static");
            var leftAttack  = loader.GetAnimation("./animations/sword_left_attack");
            var rightAttack = loader.GetAnimation("./animations/sword_right_attack");
            var leftBlock   = loader.GetAnimation("./animations/sword_left_block");
            var rightBlock  = loader.GetAnimation("./animations/sword_right_block");

            return(new Sword(
                       @static,
                       leftAttack,
                       rightAttack,
                       leftBlock,
                       rightBlock,
                       @static));
        }
Esempio n. 5
0
        private static void Main(string[] args)
        {
            using var engine = EngineBuilder.BuildEngine25D(new EngineOptions("simple 3d game", 720, 1280, false, UiResourcesHelper.PressStart2PFontPath));
            var resourceLoader = new ResourceCachedLoader();
            var player         = new MyPlayer(new Vector2(2.0f, 7.0f), new Vector2(0.3f, 0.3f), MathF.PI, 10);
            var loader         = new ResourceCachedLoader();
            var wallTexture    = Sprite.Load("./sprites/wall2.png");
            var floorTexture   = Sprite.Load("./sprites/floor2.png");
            var ceilingTexture = Sprite.Load("./sprites/ceiling2.png");


            var sword = Sword.Create(loader);
            var bow   = Bow.Create(loader);

            player.Weapons = new Weapon[] { bow, sword };

            var storage = new MapTextureStorage(ceilingTexture, wallTexture, floorTexture);
            var objects = new IMapObject[]
            {
                Lamp1.Create(new Vector2(2f, 2f)),
                Lamp1.Create(new Vector2(12f, 2f)),
                Lamp1.Create(new Vector2(2f, 7f)),
                Lamp1.Create(new Vector2(12f, 7f)),
                Lich.Create(loader, new Vector2(8.5f, 2.5f), 0)
            };
            var map = Map.FromStrings(new[]
            {
                "##############",
                "#............#",
                "#............#",
                "#....###.....#",
                "#....###.....#",
                "#....###.....#",
                "#............#",
                "#............#",
                "##############"
            }, storage.GetCellByChar);

            var level = new Scene(player, map, objects);

            while (engine.Update(level))
            {
            }
        }
Esempio n. 6
0
        public static Rat Create(ResourceCachedLoader loader, Vector2 position, float directionAngle)
        {
            var staticAnimation         = loader.GetAnimation("./animations/rat/static");
            var playerFollowerAnimation = loader.GetAnimation("./animations/rat/moving");
            var attackAnimation         = loader.GetAnimation("./animations/rat/attack");
            var deathSound    = loader.GetSound(MusicResourceHelper.RatDeathSoundPath);
            var deadAnimation = loader.GetAnimation("./animations/rat/dead");
            var attackSound   = loader.GetSound(MusicResourceHelper.RatAttackPath);
            var hitSound      = loader.GetSound(MusicResourceHelper.RatHitPath);
            var size          = new Vector2(0.3f, 0.3f);

            return(new Rat(
                       staticAnimation,
                       playerFollowerAnimation,
                       attackAnimation,
                       position,
                       size,
                       directionAngle,
                       deathSound,
                       deadAnimation,
                       attackSound,
                       hitSound));
        }
Esempio n. 7
0
        public static GreenLight Create(ResourceCachedLoader loader, Vector2 position, Vector2 size, float directionAngle)
        {
            var sprite = loader.GetSprite("./sprites/greenlight.png");

            return(new GreenLight(position, size, directionAngle, sprite));
        }