-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
18 changed files
with
155 additions
and
36 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
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
14 changes: 13 additions & 1 deletion
14
src/Libs/Components/Render/Animation/CharacterAnimatorComponent.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 |
---|---|---|
@@ -1,11 +1,23 @@ | ||
using System.Numerics; | ||
using Components.Data; | ||
using MonoGame.Aseprite.Sprites; | ||
using Scellecs.Morpeh; | ||
using Services.Math; | ||
|
||
namespace Components.Render.Animation; | ||
|
||
public struct CharacterAnimatorComponent(Sector facing, AnimatedSprite animation) : IComponent | ||
public interface IPivotted | ||
{ | ||
public Vector2 GetOffPivot(TransformComponent entityTransform); | ||
} | ||
|
||
public struct CharacterAnimatorComponent(Sector facing, AnimatedSprite animation, TransformComponent transform) | ||
: IComponent, IPivotted | ||
{ | ||
public Sector Facing = facing; | ||
public AnimatedSprite Animation = animation; | ||
public TransformComponent LocalTransform { get; } = transform; | ||
|
||
public Vector2 GetOffPivot(TransformComponent entityTransform) => | ||
entityTransform.GetOffPivot(Animation.Width, Animation.Height); | ||
} |
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 |
---|---|---|
@@ -1,9 +1,16 @@ | ||
using MonoGame.Aseprite.Sprites; | ||
using System.Numerics; | ||
using Components.Data; | ||
using Components.Render.Animation; | ||
using MonoGame.Aseprite.Sprites; | ||
using Scellecs.Morpeh; | ||
|
||
namespace Components.Render.Static; | ||
|
||
public readonly struct SpriteComponent(Sprite sprite) : IComponent | ||
public readonly struct SpriteComponent(Sprite sprite, TransformComponent transform) : IComponent, IPivotted | ||
{ | ||
public Sprite Sprite { get; } = sprite; | ||
public TransformComponent LocalTransform { get; } = transform; | ||
|
||
public Vector2 GetOffPivot(TransformComponent entityTransform) => | ||
entityTransform.GetOffPivot(Sprite.Width, Sprite.Height); | ||
} |
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
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
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
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