try to add to Player logic animate move
This commit is contained in:
parent
b14e869e44
commit
f2c73bb3af
2 changed files with 22 additions and 10 deletions
|
@ -12,7 +12,9 @@ public class AssetManager
|
||||||
|
|
||||||
public AssetContainer Player = new()
|
public AssetContainer Player = new()
|
||||||
{
|
{
|
||||||
Animations = [ "player_look_down", "player_run_up"],
|
Animations = [ "player_look_down", "player_run_up", "player_run_down", "player_run_right",
|
||||||
|
"player_run_left", "player_run_right_up", "player_run_left_up", "player_run_right_down",
|
||||||
|
"player_run_left_down" ],
|
||||||
IdleAnimation = "player_look_down"
|
IdleAnimation = "player_look_down"
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -43,32 +43,42 @@ public class Player : LivingEntity
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
#region анимация управления, стрельбы
|
#region анимация управления, стрельбы
|
||||||
|
var textureName = (graphicsComponent as AnimatedGraphicsComponent).CurrentAnimation.TextureName;
|
||||||
|
var animatedGraphicsComponent = graphicsComponent as AnimatedGraphicsComponent;
|
||||||
switch(AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation))
|
switch(AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation))
|
||||||
{
|
{
|
||||||
case ScopeState.Top:
|
case ScopeState.Top:
|
||||||
if ((graphicsComponent as AnimatedGraphicsComponent).CurrentAnimation.TextureName!="player_run_up")
|
|
||||||
(graphicsComponent as AnimatedGraphicsComponent).StartCyclingAnimation("player_run_up");
|
if ((graphicsComponent as AnimatedGraphicsComponent).CurrentAnimation.TextureName!="player_run_right")
|
||||||
|
(graphicsComponent as AnimatedGraphicsComponent).StartCyclingAnimation("player_run_right");
|
||||||
break;
|
break;
|
||||||
case ScopeState.Down:
|
case ScopeState.Down:
|
||||||
StartAnimation("player_run_down");
|
if (textureName!="player_run_down")
|
||||||
|
animatedGraphicsComponent.StartCyclingAnimation("player_run_down");
|
||||||
break;
|
break;
|
||||||
case ScopeState.Right:
|
case ScopeState.Right:
|
||||||
StartAnimation("player_run_right");
|
if (textureName!="player_run_up")
|
||||||
|
animatedGraphicsComponent.StartCyclingAnimation("player_run_up");
|
||||||
break;
|
break;
|
||||||
case ScopeState.Left:
|
case ScopeState.Left:
|
||||||
StartAnimation("left");
|
if (textureName!="player_run_left")
|
||||||
|
animatedGraphicsComponent.StartCyclingAnimation("player_run_left");
|
||||||
break;
|
break;
|
||||||
case ScopeState.TopRight:
|
case ScopeState.TopRight:
|
||||||
StartAnimation("player_run_right_up");
|
if (textureName!="player_run_right_up")
|
||||||
|
animatedGraphicsComponent.StartCyclingAnimation("player_run_right_up");
|
||||||
break;
|
break;
|
||||||
case ScopeState.TopLeft:
|
case ScopeState.TopLeft:
|
||||||
StartAnimation("player_run_left_up");
|
if (textureName!="player_run_left_up")
|
||||||
|
animatedGraphicsComponent.StartCyclingAnimation("player_run_left_up");
|
||||||
break;
|
break;
|
||||||
case ScopeState.DownRight:
|
case ScopeState.DownRight:
|
||||||
StartAnimation("player_run_right_down");
|
if (textureName!="player_run_right_down")
|
||||||
|
animatedGraphicsComponent.StartCyclingAnimation("player_run_right_down");
|
||||||
break;
|
break;
|
||||||
case ScopeState.DownLeft:
|
case ScopeState.DownLeft:
|
||||||
StartAnimation("player_run_left_down");
|
if (textureName!="player_run_left_down")
|
||||||
|
animatedGraphicsComponent.StartCyclingAnimation("player_run_left_down");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Add table
Reference in a new issue