Add cycling animation
This commit is contained in:
parent
6b55b595c5
commit
b14e869e44
3 changed files with 14 additions and 3 deletions
|
@ -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"
|
||||
};
|
||||
}
|
|
@ -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");
|
||||
|
|
|
@ -139,6 +139,17 @@ namespace ZoFo.GameCore.Graphics
|
|||
|
||||
}
|
||||
|
||||
public void StartCyclingAnimation(string startedanimationId)
|
||||
{
|
||||
currentFrame = 0;
|
||||
currentAnimation = animations.Find(x => x.Id == startedanimationId);
|
||||
currentAnimation.IsCycle = true;
|
||||
|
||||
buildSourceRectangle();
|
||||
SetInterval();
|
||||
|
||||
}
|
||||
|
||||
public void StopAnimation()
|
||||
{
|
||||
currentFrame = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue