-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d7188c
commit cb22a81
Showing
7 changed files
with
153 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
EndlessClient/Rendering/CharacterProperties/WeaponSlashRenderer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using EndlessClient.Rendering.Metadata.Models; | ||
using EndlessClient.Rendering.Sprites; | ||
using EOLib; | ||
using EOLib.Domain.Character; | ||
using Microsoft.Xna.Framework; | ||
using Microsoft.Xna.Framework.Graphics; | ||
|
||
namespace EndlessClient.Rendering.CharacterProperties | ||
{ | ||
public class WeaponSlashRenderer : BaseCharacterPropertyRenderer | ||
{ | ||
private readonly ISpriteSheet _slashSheet; | ||
|
||
public override bool CanRender => _slashSheet.HasTexture && _renderProperties.WeaponGraphic != 0 && _renderProperties.RenderAttackFrame == 2; | ||
|
||
protected override bool ShouldFlip => false; | ||
|
||
public WeaponSlashRenderer(CharacterRenderProperties renderProperties, | ||
ISpriteSheet slashSheet) | ||
: base(renderProperties) | ||
{ | ||
_slashSheet = slashSheet; | ||
} | ||
|
||
public override void Render(SpriteBatch spriteBatch, Rectangle parentCharacterDrawArea, WeaponMetadata weaponMetadata) | ||
{ | ||
if (weaponMetadata.Slash == null || weaponMetadata.Ranged) | ||
return; | ||
|
||
var offsets = GetOffsets(parentCharacterDrawArea) - new Vector2(0, _renderProperties.Gender); | ||
Render(spriteBatch, _slashSheet, parentCharacterDrawArea.Location.ToVector2() + offsets, 96); | ||
} | ||
|
||
private Vector2 GetOffsets(Rectangle parentCharacterDrawArea) | ||
{ | ||
return _renderProperties.Direction switch | ||
{ | ||
EODirection.Down => new Vector2(-30, 4), | ||
EODirection.Left => new Vector2(-34, -9), | ||
EODirection.Up => new Vector2(-6, -9), | ||
EODirection.Right => new Vector2(-10, 4), | ||
_ => Vector2.Zero | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.