diff --git a/ZoFo/GameCore/GameManagers/AssetsManager/AssetManager.cs b/ZoFo/GameCore/GameManagers/AssetsManager/AssetManager.cs index 334957f..78fbf78 100644 --- a/ZoFo/GameCore/GameManagers/AssetsManager/AssetManager.cs +++ b/ZoFo/GameCore/GameManagers/AssetsManager/AssetManager.cs @@ -12,7 +12,7 @@ public class AssetManager public AssetContainer Player = new() { - Animations = [ "player_look_down" ], + Animations = [ "player_look_down", "player_run_up"], IdleAnimation = "player_look_down" }; } \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index c76c1bc..baec6d3 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -46,8 +46,8 @@ public class Player : LivingEntity switch(AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation)) { case ScopeState.Top: - //if ((graphicsComponent as AnimatedGraphicsComponent).CurrentAnimation.TextureName!="player_run_up") - //(graphicsComponent as AnimatedGraphicsComponent).Star ("player_run_up"); + if ((graphicsComponent as AnimatedGraphicsComponent).CurrentAnimation.TextureName!="player_run_up") + (graphicsComponent as AnimatedGraphicsComponent).StartCyclingAnimation("player_run_up"); break; case ScopeState.Down: StartAnimation("player_run_down"); diff --git a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs index 85c4a7e..86af079 100644 --- a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs +++ b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs @@ -138,6 +138,17 @@ namespace ZoFo.GameCore.Graphics SetInterval(); } + + public void StartCyclingAnimation(string startedanimationId) + { + currentFrame = 0; + currentAnimation = animations.Find(x => x.Id == startedanimationId); + currentAnimation.IsCycle = true; + + buildSourceRectangle(); + SetInterval(); + + } public void StopAnimation() {