/// <summary> /// Method for drawing wepons /// </summary> /// <param name="elapsedTime">Elapsed time in milleseconds</param> /// <param name="unitState">Unit state</param> /// <param name="weaponAnimation">Wepon animation</param> /// <param name="unit">Unit object</param> private void DrawWeapon(float elapsedTime, Model.State unitState, Model.State weaponAnimation, Model.Unit unit) { //Drawing wepons if (unit.IsAttacking && !unit.IsCastingSpell)// && m_player.IsAlive())//Player is alive: bugfix, not needed { if (weaponAnimation > 0) { #region Displacement int displacementX = 0; int displacementY = 0; if (weaponAnimation == Model.State.FACING_CAMERA || weaponAnimation == Model.State.MOVING_DOWN) { displacementX = -11; displacementY = 25; if (unit.GetType() == Model.GameModel.ENEMY_NPC) { displacementX = -5; } } else if (weaponAnimation == Model.State.MOVING_UP) { displacementX = +11; displacementY = -10; } else if (weaponAnimation == Model.State.MOVING_LEFT) { displacementX = -20; displacementY = +5; if (unit.GetType() == Model.GameModel.ENEMY_NPC) { displacementX = -10; displacementY = +12; } } else { displacementX = +20; displacementY = +5; if (unit.GetType() == Model.GameModel.ENEMY_NPC) { displacementX = +22; displacementY = +15; } } #endregion Vector2 swordPosition = _camera.VisualizeCordinates(unit.ThisUnit.Bounds.X + displacementX, unit.ThisUnit.Bounds.Y + displacementY); _animationSystem.UpdateAndDraw(_swordTime, Color.White, swordPosition, weaponAnimation, AnimationSystem.Texture.WEAPON_SWORD); } } _swordTime = 0; }
//Metod för utritning av vapen private void DrawWeapon(float a_elapsedTime, int a_unitAnimation, int a_weaponAnimation, Model.Unit a_unit) { //Ritar vapen if (a_unit.IsAttacking && !a_unit.IsCastingSpell)// && m_player.IsAlive())//Player is alive: buggfix, skall ej behövas { if (a_weaponAnimation > 0) { #region Displacement int displacementX = 0; int displacementY = 0; if (a_weaponAnimation == AnimationSystem.FACING_CAMERA || a_weaponAnimation == AnimationSystem.MOVING_DOWN) { displacementX = -11; displacementY = 25; if (a_unit.GetType() == Model.GameModel.ENEMY_NPC) { displacementX = -5; } } else if (a_weaponAnimation == AnimationSystem.MOVING_UP) { displacementX = +11; displacementY = -10; } else if (a_weaponAnimation == AnimationSystem.MOVING_LEFT) { displacementX = -20; displacementY = +5; if (a_unit.GetType() == Model.GameModel.ENEMY_NPC) { displacementX = -10; displacementY = +12; } } else { displacementX = +20; displacementY = +5; if (a_unit.GetType() == Model.GameModel.ENEMY_NPC) { displacementX = +22; displacementY = +15; } } #endregion Vector2 swordPosition = m_camera.VisualizeCordinates(a_unit.ThisUnit.Bounds.X + displacementX, a_unit.ThisUnit.Bounds.Y + displacementY); m_animationSystem.UpdateAndDraw(m_swordTime, Color.White, swordPosition, a_weaponAnimation, AnimationSystem.WEAPON_SWORD); } } m_swordTime = 0; }
/// <summary> /// Method for drawing the unit target circle /// </summary> /// <param name="player">Player object</param> /// <param name="unit">Unit object</param> private void DrawTargetCircle(Model.Player player, Model.Unit unit) { Vector2 position = _camera.VisualizeCordinates(unit.ThisUnit.Bounds.X + 1, unit.ThisUnit.Bounds.Y + 28); if (player.Target == unit) { //Enemies if (unit.GetType() == Model.GameModel.ENEMY_NPC) { _spriteBatch.Draw(_textures[Convert.ToInt32(Texture.RED_CIRCLE)], position, Color.White); } //NPCs if (unit.GetType() == Model.GameModel.FRIENDLY_NPC) { _spriteBatch.Draw(_textures[Convert.ToInt32(Texture.GREEN_CIRCLE)], position, Color.White); } } }
//Metod för utritning av target cirkel kring NPCs private void DrawTargetCircle(Model.Player a_player, Model.Unit a_unit) { Vector2 position = m_camera.VisualizeCordinates(a_unit.ThisUnit.Bounds.X + 1, a_unit.ThisUnit.Bounds.Y + 28); if (a_player.Target == a_unit) { //Enemy NPC if (a_unit.GetType() == Model.GameModel.ENEMY_NPC) { m_spriteBatch.Draw(m_textures[RED_CIRCLE], position, Color.White); } //Friendly NPC if (a_unit.GetType() == Model.GameModel.FRIENDLY_NPC) { m_spriteBatch.Draw(m_textures[GREEN_CIRCLE], position, Color.White); } } }