Beispiel #1
0
        public object Clone()
        {
            var animationClone = new Animation(this)
            {
                frameWidth = this.frameWidth,
                frameHeight = this.frameHeight
            };

            animationClone.Reset();

            return animationClone;
        }
Beispiel #2
0
        protected override void LoadContent()
        {
            lme = new LevelManagement();
            this.LoadBackground(this.LevelNumber);
            //font setup
            this.font = MGame.Content.Load<SpriteFont>("Fonts/YoukaiFont");
            this.smallFont = MGame.Content.Load<SpriteFont>("Fonts/YoukaiFontSmall");
            this.gameLogQueue = new Queue<string>();
            if (this.LevelNumber == LevelNumber.One)
            {
                this.currentLog1 = "Please, destroy the monster which threatens our village!";
                this.currentLog2 = string.Format("Welcome, {0}!", this.MGame.Engine.Hero.Name);
                this.currentLog3 = "";
            }
            else
            {
                this.currentLog1 = "Your journey continues...";
                this.currentLog2 = "";
                this.currentLog3 = "";
            }
            heroDeathMessage = true;
            this.logBackgroundTexture = MGame.Content.Load<Texture2D>("Sprites/UI/UI_LogBackground");
            this.deathTimer = new Timer(3000);

            this.LoadAnimations();

            //UI
            //player health
            healthTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Game_HealthBar");
            fillHealthTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            fillHealthTexture.SetData<Color>(new Color[] { Color.Red });
            currentHealthTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            currentHealthTexture.SetData<Color>(new Color[] { Color.GreenYellow });
            //player mana
            fillManaTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            fillManaTexture.SetData<Color>(new Color[] { Color.DimGray });
            currentManaTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            currentManaTexture.SetData<Color>(new Color[] { Color.SkyBlue });
            //guide screen
            this.guideBackgroundTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_message_field");
            this.takeButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_TakeButton");
            this.takeButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_TakeButton_hover");
            this.throwButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_ThrowButton");
            this.throwButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_ThrowButton_hover");
            this.cancelButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_CancelButton");
            this.cancelButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_CancelButton_hover");
            this.enterButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_EnterButton");
            this.enterButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_EnterButton_hover");
            this.lootButton1 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton2 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton3 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton4 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton5 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.throwButton = new Button(throwButtonTexture, throwButtonHoverTexture);
            this.cancelButton = new Button(cancelButtonTexture, cancelButtonHoverTexture);
            this.enterButton = new Button(enterButtonTexture, enterButtonHoverTexture);
            //PLAYER
            #region PLAYER
            switch (this.MGame.HeroType)
            {
                case CharacterType.Samurai:
                    {
                        this.playerSprite = this.MGame.Content.Load<Texture2D>("Sprites/PlayerClasses/Male_Samurai");
                        break;
                    }
                case CharacterType.Monk:
                    {
                        this.playerSprite = this.MGame.Content.Load<Texture2D>("Sprites/PlayerClasses/Male_Monk");
                        break;
                    }
                case CharacterType.Ninja:
                    {
                        this.playerSprite = this.MGame.Content.Load<Texture2D>("Sprites/PlayerClasses/Female_Ninja");
                        break;
                    }
            }
            #endregion

            mPlayerSprite = new PlayerSprite(playerSprite, animations, this.MGame.Engine.Hero);
            if (this.LevelNumber == LevelNumber.Two)
            {
                mPlayerSprite.Position = new Vector2(1000, 1900);
            }

            //Spells
            fireballTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_Fireball");
            var spellAnimation = new Animation(2, 50, 50, 0, 0);
            fireballSprite = new SpecialEffectSprite(fireballTexture, spellAnimation);
            enemySpellTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_Lightningball");
            enemySpellSprite = new SpecialEffectSprite(enemySpellTexture, spellAnimation);
            equaizerTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_Equalizer");
            equalizerSprite = new SpecialEffectSprite(equaizerTexture, spellAnimation);
            protectingShadowTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_ProtectingShadow");
            var protectionAnimation = new Animation(2, 48, 64, 0, 0);
            protectingShadowSprite = new SpecialEffectSprite(protectingShadowTexture, protectionAnimation);

            //sounds
            weaponHitSoundEffect = MGame.Content.Load<SoundEffect>("Sounds/Weapon_Hit_SFX");
            fireballSoundEffect = MGame.Content.Load<SoundEffect>("Sounds/Fireball_SFX");
            openChestSoundEffect = MGame.Content.Load<SoundEffect>("Sounds/Open_Chest_SFX");
            playBGM = true;
            bgm01 = MGame.Content.Load<SoundEffect>("Sounds/BGM_01");
            bgm02 = MGame.Content.Load<SoundEffect>("Sounds/BGM_02");
            //Loot
            lootTexture = MGame.Content.Load<Texture2D>("Sprites/Inventory/Int_Loot");
            lootList = new List<string>();

            var levCallDelegate = new LevelCallDelegate(LoadBackground);
            levCallDelegate += LoadEnvironment;
            levCallDelegate += LoadEnemySprites;
            levCallDelegate += PlayBgm;
            levCallDelegate(this.LevelNumber);
        }
Beispiel #3
0
 private Animation(Animation animation)
 {
     this.frames = animation.frames;
     this.FramesPerSecond = 5;
 }