예제 #1
0
        //Metod för utritning av Items på kartan samt sättande spelarens Itemtarget
        private void DrawItems(float a_elapsedTime)
        {
            List <Model.Item> items = m_gameModel.m_itemSystem.m_items;

            Model.Player player = m_gameModel.m_playerSystem.m_player;

            foreach (Model.Item item in items)
            {
                if (m_inputHandler.MouseIsOver(m_camera.VisualizeRectangle(item.ThisItem.Bounds)))
                {
                    m_inputHandler.MouseIsOverLoot = true;
                }

                //Kontrollerar om spelaren har targetat ett item.
                if (m_inputHandler.DidGetTargetedByLeftClick(m_camera.VisualizeRectangle(item.ThisItem.Bounds)))
                {
                    player.ItemTarget = item;
                }

                if (player.ItemTarget == item)
                {
                    if (m_inputHandler.DidGetTargetedByLeftClick(m_camera.VisualizeRectangle(item.ThisItem.Bounds)) &&
                        player.ItemTarget.ThisItem.Bounds.Intersects(player.CollisionArea) && !m_lootWatch.IsRunning)
                    {
                        item.WasLooted = true;
                    }
                    else
                    {
                        item.WasLooted = false;
                    }
                }

                if (item.GetType() == Model.GameModel.ARMOR)
                {
                    Model.Armor Armor = item as Model.Armor;

                    if (Armor.Type == Model.Armor.HEAD_ARMOR)
                    {
                        Vector2 position      = m_camera.VisualizeCordinates(Armor.ThisItem.Bounds.Location.X, Armor.ThisItem.Bounds.Location.Y);
                        int     itemAnimation = 0;

                        itemAnimation = AnimationSystem.FACING_CAMERA;

                        m_animationSystem.UpdateAndDraw(a_elapsedTime, Color.White, position, itemAnimation, AnimationSystem.ITEM_PURPLE_CHEST);
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Method for drawing of map Items as well as setting the players item targets
        /// </summary>
        /// <param name="elapsedTime">Elapsed time in milleseconds</param>
        private void DrawItems(float elapsedTime, Model.Player player)
        {
            List <Model.Item> items = _gameModel.ItemSystem._items;

            foreach (Model.Item item in items)
            {
                if (_inputHandler.MouseIsOver(_camera.VisualizeRectangle(item.ThisItem.Bounds)))
                {
                    _inputHandler.MouseIsOverLoot = true;
                }

                //Checks if the player targeted an item
                if (_inputHandler.DidGetTargetedByLeftClick(_camera.VisualizeRectangle(item.ThisItem.Bounds)))
                {
                    player.ItemTarget = item;
                }

                if (player.ItemTarget == item)
                {
                    if (_inputHandler.DidGetTargetedByLeftClick(_camera.VisualizeRectangle(item.ThisItem.Bounds)) &&
                        player.ItemTarget.ThisItem.Bounds.Intersects(player.CollisionArea) && !_lootWatch.IsRunning)
                    {
                        item.WasLooted = true;
                    }
                    else
                    {
                        item.WasLooted = false;
                    }
                }

                if (item.GetType() == Model.GameModel.ARMOR)
                {
                    Model.Armor Armor = item as Model.Armor;

                    if (Armor.Type == Model.Armor.HEAD_ARMOR)
                    {
                        Vector2     position      = _camera.VisualizeCordinates(Armor.ThisItem.Bounds.Location.X, Armor.ThisItem.Bounds.Location.Y);
                        Model.State itemAnimation = 0;

                        itemAnimation = Model.State.FACING_CAMERA;

                        _animationSystem.UpdateAndDraw(elapsedTime, Color.White, position, itemAnimation, AnimationSystem.Texture.ITEM_PURPLE_CHEST);
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Method for drawing the player
        /// </summary>
        /// <param name="elapsedTime">Elapsed time in milleseconds</param>
        private void DrawPlayer(float elapsedTime)
        {
            if (_player.IsAlive())
            {
                DrawWeapon(elapsedTime, _player.UnitState, _player.WeaponState, _player);
            }
            else
            {
                _player.UnitState = Model.State.IS_DEAD;
            }

            //Drawing player
            Vector2 playerPosition = _camera.VisualizeCordinates(_player.ThisUnit.Bounds.X, _player.ThisUnit.Bounds.Y);

            _animationSystem.UpdateAndDraw(elapsedTime, Color.White, playerPosition, _player.UnitState, AnimationSystem.Texture.PLAYER);

            //Armor
            if (_player.HasHelm)
            {
                DrawArmor(elapsedTime, _player, _player.UnitState, AnimationSystem.Texture.ARMOR_HEAD);
            }
        }
        //Metod för utritning av skärm för klassval
        internal void DrawClassSelectionScreen(float a_elapsedTime)
        {
            PlayStartTheme();

            //Ritar bakgrund
            DrawImage(SCREEN_CLASS_SELECT, Vector2.Zero, new Point(1280, 720), 1f);

            //Positioner för animationer
            Vector2 templarPosition    = new Vector2(300, 170);
            Vector2 prophetPosition    = new Vector2(616, 170);
            Vector2 descendantPosition = new Vector2(916, 170);

            //Rektanglar för select-knappar
            Rectangle selectTemplar    = new Rectangle(209, 600, 256, 50);
            Rectangle selectProphet    = new Rectangle(0, 0, 512, 100);
            Rectangle selectDescendant = new Rectangle(0, 0, 512, 100);

            #region Templar
            if (m_inputHandler.MouseIsOver(new Rectangle((int)templarPosition.X, (int)templarPosition.Y, 64, 64)) || m_showTemplarSelection)
            {
                if (m_showTemplarSelection)
                {
                    m_spriteBatch.Draw(m_screenTextures[SCREEN_SELECT_TEMPLAR], new Vector2(185, 0), new Rectangle(0, 0, 300, 720), Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f);
                    m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, templarPosition, AnimationSystem.MOVING_DOWN, AnimationSystem.CLASS_SCREEN_TEMPLAR);
                    m_spriteBatch.Draw(m_screenButtons[BUTTONS_SELECT], new Vector2(203, 601), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
                    #region SelectButton
                    if (m_inputHandler.MouseIsOver(selectTemplar))
                    {
                        m_spriteBatch.Draw(m_screenButtons[BUTTONS_SELECT_SELECTED], new Vector2(209, 600), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
                        PlayMenuSound(SoundHandler.MENU_BUTTON_HOVER);

                        if (m_inputHandler.DidGetTargetedByLeftClick(selectTemplar))
                        {
                            PlayMenuSound(SoundHandler.MENU_BUTTON_SELECT_B);
                            m_didChooseClass = true;
                        }
                    }
                    else
                    {
                        m_didHover = false;
                    }
                    #endregion
                }
                else
                {
                    m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, templarPosition, AnimationSystem.FACING_CAMERA, AnimationSystem.CLASS_SCREEN_TEMPLAR);
                }

                if (m_inputHandler.DidGetTargetedByLeftClick(new Rectangle((int)templarPosition.X, (int)templarPosition.Y, 64, 64)))
                {
                    PlayMenuSound(SoundHandler.MENU_BUTTON_SELECT);
                    m_showTemplarSelection    = true;
                    m_showProphetSelection    = false;
                    m_showDescendantSelection = false;
                }
            }
            else if (!m_showTemplarSelection)
            {
                m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, templarPosition, AnimationSystem.FACING_AWAY, AnimationSystem.CLASS_SCREEN_TEMPLAR);
            }

            #endregion

            #region Prophet
            if (m_inputHandler.MouseIsOver(new Rectangle((int)prophetPosition.X, (int)prophetPosition.Y, 64, 64)) || m_showProphetSelection)
            {
                if (m_showProphetSelection)
                {
                    m_spriteBatch.Draw(m_screenTextures[SCREEN_SELECT_PROPHET], new Vector2(501, 0), new Rectangle(0, 0, 300, 720), Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f);
                    m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, prophetPosition, AnimationSystem.MOVING_DOWN, AnimationSystem.CLASS_SCREEN_PROPHET);

                    m_spriteBatch.Draw(m_screenButtons[BUTTONS_SELECT_GRAY], new Vector2(525, 600), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
                }
                else
                {
                    m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, prophetPosition, AnimationSystem.FACING_CAMERA, AnimationSystem.CLASS_SCREEN_PROPHET);
                }

                if (m_inputHandler.DidGetTargetedByLeftClick(new Rectangle((int)prophetPosition.X, (int)prophetPosition.Y, 64, 64)))
                {
                    PlayMenuSound(SoundHandler.MENU_BUTTON_SELECT);
                    m_showTemplarSelection    = false;
                    m_showProphetSelection    = true;
                    m_showDescendantSelection = false;
                }
            }
            else if (!m_showProphetSelection)
            {
                m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, prophetPosition, AnimationSystem.FACING_AWAY, AnimationSystem.CLASS_SCREEN_PROPHET);
            }
            #endregion

            #region Descendant
            if (m_inputHandler.MouseIsOver(new Rectangle((int)descendantPosition.X, (int)descendantPosition.Y, 64, 64)) || m_showDescendantSelection)
            {
                if (m_showDescendantSelection)
                {
                    m_spriteBatch.Draw(m_screenTextures[SCREEN_SELECT_DESCENDANT], new Vector2(801, 0), new Rectangle(0, 0, 300, 720), Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f);
                    m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, descendantPosition, AnimationSystem.MOVING_DOWN, AnimationSystem.CLASS_SCREEN_DESCENDANT);
                    m_spriteBatch.Draw(m_screenButtons[BUTTONS_SELECT_GRAY], new Vector2(825, 600), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
                }
                else
                {
                    m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, descendantPosition, AnimationSystem.FACING_CAMERA, AnimationSystem.CLASS_SCREEN_DESCENDANT);
                }

                if (m_inputHandler.DidGetTargetedByLeftClick(new Rectangle((int)descendantPosition.X, (int)descendantPosition.Y, 64, 64)))
                {
                    PlayMenuSound(SoundHandler.MENU_BUTTON_SELECT);
                    m_showTemplarSelection    = false;
                    m_showProphetSelection    = false;
                    m_showDescendantSelection = true;
                }
            }
            else if (!m_showDescendantSelection)
            {
                m_animationSys.UpdateAndDraw(a_elapsedTime, Color.White, descendantPosition, AnimationSystem.FACING_AWAY, AnimationSystem.CLASS_SCREEN_DESCENDANT);
            }
            #endregion
        }
예제 #5
0
        /// <summary>
        /// Method for drawing the class selection screen
        /// </summary>
        /// <param name="elapsedTime">Elapsed time in milleseconds</param>
        internal void DrawClassSelectionScreen(float elapsedTime)
        {
            PlayStartTheme();
            //Drawing background
            DrawImage(Screen.SCREEN_CLASS_SELECT, Vector2.Zero, new Point(1280, 720), 1f);

            //Positions for animations
            Vector2 templarPosition    = new Vector2(300, 170);
            Vector2 prophetPosition    = new Vector2(616, 170);
            Vector2 descendantPosition = new Vector2(916, 170);

            //Button areas for select buttons
            Rectangle selectTemplar    = new Rectangle(209, 600, 256, 50);
            Rectangle selectProphet    = new Rectangle(0, 0, 512, 100);
            Rectangle selectDescendant = new Rectangle(0, 0, 512, 100);

            #region Templar
            if (_inputHandler.MouseIsOver(new Rectangle((int)templarPosition.X, (int)templarPosition.Y, 64, 64)) || _showTemplarSelection)
            {
                if (_showTemplarSelection)
                {
                    _spriteBatch.Draw(_screenContent.Screens[Convert.ToInt32(Screen.SCREEN_SELECT_TEMPLAR)], new Vector2(185, 0), new Rectangle(0, 0, 300, 720), Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f);
                    _animationSys.UpdateAndDraw(elapsedTime, Color.White, templarPosition, Model.State.MOVING_DOWN, AnimationSystem.Texture.CLASS_SCREEN_TEMPLAR);
                    _spriteBatch.Draw(_screenContent.Buttons[Convert.ToInt32(Button.BUTTONS_SELECT)], new Vector2(203, 601), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);

                    #region SelectButton
                    if (_inputHandler.MouseIsOver(selectTemplar))
                    {
                        _spriteBatch.Draw(_screenContent.Buttons[Convert.ToInt32(Button.BUTTONS_SELECT_SELECTED)], new Vector2(209, 600), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
                        PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_HOVER);

                        if (_inputHandler.DidGetTargetedByLeftClick(selectTemplar))
                        {
                            PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_SELECT_B);
                            DidChooseClass = true;
                        }
                    }
                    else
                    {
                        _didHover = false;
                    }
                    #endregion
                }
                else
                {
                    _animationSys.UpdateAndDraw(elapsedTime, Color.White, templarPosition, Model.State.FACING_CAMERA, AnimationSystem.Texture.CLASS_SCREEN_TEMPLAR);
                }

                if (_inputHandler.DidGetTargetedByLeftClick(new Rectangle((int)templarPosition.X, (int)templarPosition.Y, 64, 64)))
                {
                    PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_SELECT);
                    _showTemplarSelection    = true;
                    _showProphetSelection    = false;
                    _showDescendantSelection = false;
                }
            }
            else if (!_showTemplarSelection)
            {
                _animationSys.UpdateAndDraw(elapsedTime, Color.White, templarPosition, Model.State.FACING_AWAY, AnimationSystem.Texture.CLASS_SCREEN_TEMPLAR);
            }
            #endregion

            #region Prophet
            if (_inputHandler.MouseIsOver(new Rectangle((int)prophetPosition.X, (int)prophetPosition.Y, 64, 64)) || _showProphetSelection)
            {
                if (_showProphetSelection)
                {
                    _spriteBatch.Draw(_screenContent.Screens[Convert.ToInt32(Screen.SCREEN_SELECT_PROPHET)], new Vector2(501, 0), new Rectangle(0, 0, 300, 720), Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f);
                    _animationSys.UpdateAndDraw(elapsedTime, Color.White, prophetPosition, Model.State.MOVING_DOWN, AnimationSystem.Texture.CLASS_SCREEN_PROPHET);
                    _spriteBatch.Draw(_screenContent.Buttons[Convert.ToInt32(Button.BUTTONS_SELECT_GRAY)], new Vector2(525, 600), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
                }
                else
                {
                    _animationSys.UpdateAndDraw(elapsedTime, Color.White, prophetPosition, Model.State.FACING_CAMERA, AnimationSystem.Texture.CLASS_SCREEN_PROPHET);
                }

                if (_inputHandler.DidGetTargetedByLeftClick(new Rectangle((int)prophetPosition.X, (int)prophetPosition.Y, 64, 64)))
                {
                    PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_SELECT);
                    _showTemplarSelection    = false;
                    _showProphetSelection    = true;
                    _showDescendantSelection = false;
                }
            }
            else if (!_showProphetSelection)
            {
                _animationSys.UpdateAndDraw(elapsedTime, Color.White, prophetPosition, Model.State.FACING_AWAY, AnimationSystem.Texture.CLASS_SCREEN_PROPHET);
            }
            #endregion

            #region Descendant
            if (_inputHandler.MouseIsOver(new Rectangle((int)descendantPosition.X, (int)descendantPosition.Y, 64, 64)) || _showDescendantSelection)
            {
                if (_showDescendantSelection)
                {
                    _spriteBatch.Draw(_screenContent.Screens[Convert.ToInt32(Screen.SCREEN_SELECT_DESCENDANT)], new Vector2(801, 0), new Rectangle(0, 0, 300, 720), Color.White, 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f);
                    _animationSys.UpdateAndDraw(elapsedTime, Color.White, descendantPosition, Model.State.MOVING_DOWN, AnimationSystem.Texture.CLASS_SCREEN_DESCENDANT);
                    _spriteBatch.Draw(_screenContent.Buttons[Convert.ToInt32(Button.BUTTONS_SELECT_GRAY)], new Vector2(825, 600), selectProphet, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
                }
                else
                {
                    _animationSys.UpdateAndDraw(elapsedTime, Color.White, descendantPosition, Model.State.FACING_CAMERA, AnimationSystem.Texture.CLASS_SCREEN_DESCENDANT);
                }

                if (_inputHandler.DidGetTargetedByLeftClick(new Rectangle((int)descendantPosition.X, (int)descendantPosition.Y, 64, 64)))
                {
                    PlayMenuSound(SoundHandler.Effect.MENU_BUTTON_SELECT);
                    _showTemplarSelection    = false;
                    _showProphetSelection    = false;
                    _showDescendantSelection = true;
                }
            }
            else if (!_showDescendantSelection)
            {
                _animationSys.UpdateAndDraw(elapsedTime, Color.White, descendantPosition, Model.State.FACING_AWAY, AnimationSystem.Texture.CLASS_SCREEN_DESCENDANT);
            }
            #endregion
        }
예제 #6
0
        //Metod för utritning av spelare
        private void DrawPlayer(float a_elapsedTime)
        {
            if (m_player.IsAlive())
            {
                DrawWeapon(a_elapsedTime, m_player.UnitState, m_player.WeaponState, m_player);
            }
            else
            {
                m_player.UnitState = Model.Unit.IS_DEAD;
            }
            //Ritar spelare
            Vector2 playerPosition = m_camera.VisualizeCordinates(m_player.ThisUnit.Bounds.X, m_player.ThisUnit.Bounds.Y);

            m_animationSystem.UpdateAndDraw(a_elapsedTime, Color.White, playerPosition, m_player.UnitState, AnimationSystem.PLAYER);

            //Börjat leka med armor.
            if (m_player.HasHelm)
            {
                DrawArmor(a_elapsedTime, m_player, m_player.UnitState, AnimationSystem.ARMOR_HEAD);
            }
        }