-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Components; | ||
using Components.World; | ||
|
||
public partial class GameEntity | ||
{ | ||
// TODO: The kind of code generator? | ||
public void AddMovementAnimation(MovementAnimationComponent component) => | ||
AddMovementAnimation(newFacingDirection: component.FacingDirection, | ||
newPlayingAnimation: component.PlayingAnimation, | ||
newIdleAnimations: component.IdleAnimations, | ||
newWalkingAnimations: component.WalkingAnimations, | ||
newHasStopped: component.HasStopped); | ||
|
||
public void AddTransform(TransformComponent component) => | ||
AddTransform(newPosition: component.Position, newVelocity: component.Velocity); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Entitas; | ||
using Microsoft.Xna.Framework; | ||
using MonoGame.Aseprite.Sprites; | ||
using Services.Math; | ||
|
||
namespace Components; | ||
|
||
public class MovementAnimationComponent : IComponent | ||
{ | ||
private const Direction DefaultFacing = Direction.Down; | ||
|
||
public AnimatedSprite PlayingAnimation; | ||
public Dictionary<Direction, AnimatedSprite> IdleAnimations; | ||
public Dictionary<Direction, AnimatedSprite> WalkingAnimations; | ||
|
||
public Vector2 FacingDirection = Vector2.UnitY; | ||
public bool HasStopped; | ||
|
||
public MovementAnimationComponent() | ||
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (ubuntu-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (ubuntu-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (ubuntu-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (ubuntu-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (ubuntu-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (ubuntu-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (windows-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (windows-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (windows-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (windows-latest)
Check warning on line 19 in src/Libs/Components/MovementAnimationComponent.cs GitHub Actions / Build (windows-latest)
|
||
{ | ||
} | ||
|
||
public MovementAnimationComponent(Dictionary<Direction, AnimatedSprite> idleAnimations, | ||
Dictionary<Direction, AnimatedSprite> walkingAnimations) | ||
{ | ||
IdleAnimations = idleAnimations; | ||
WalkingAnimations = walkingAnimations; | ||
|
||
PlayingAnimation = idleAnimations[DefaultFacing]; | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
using Entitas; | ||
using Microsoft.Xna.Framework; | ||
using Anchor = Services.Math.RadDir; | ||
|
||
namespace Components.World; | ||
|
||
|