edited animations

This commit is contained in:
bmvolf 2023-08-17 10:56:50 +03:00
parent 39848a42ce
commit 68b7481813
3 changed files with 11 additions and 3 deletions

View file

@ -16,6 +16,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
{ {
Width = 32; Width = 32;
Height = 64; Height = 64;
GraphicsComponent.actionOfAnimationEnd += () =>
{
AppManager.Instance.ChangeGameState(GameState.GameOver);
};
} }
public bool IsAlive { get { return isAlive; } } public bool IsAlive { get { return isAlive; } }
@ -31,6 +35,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
if(monsterName == "Zombie") if(monsterName == "Zombie")
{ {
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName); DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
GraphicsComponent.actionOfAnimationEnd();
} }
isAlive = false; isAlive = false;
} }

View file

@ -10,7 +10,7 @@ namespace DangerousD.GameCore.Graphics
{ {
public class GraphicsComponent public class GraphicsComponent
{ {
//public Action actionOfAnimationEnd; public Action actionOfAnimationEnd;
private List<AnimationContainer> animations; private List<AnimationContainer> animations;
private List<Texture2D> textures; private List<Texture2D> textures;
private List<string> texturesNames; private List<string> texturesNames;
@ -116,7 +116,10 @@ namespace DangerousD.GameCore.Graphics
if (!currentAnimation.IsCycle) if (!currentAnimation.IsCycle)
{ {
currentAnimation = neitralAnimation; currentAnimation = neitralAnimation;
//actionOfAnimationEnd(); if(actionOfAnimationEnd != null)
{
actionOfAnimationEnd();
}
} }
currentFrame = 0; currentFrame = 0;

View file

@ -13,7 +13,7 @@ using DangerousD.GameCore.Managers;
namespace DangerousD.GameCore namespace DangerousD.GameCore
{ {
public enum GameState { Menu, Options, Lobby, Game, Login } public enum GameState { Menu, Options, Lobby, Game, Login, GameOver }
public class AppManager : Game public class AppManager : Game
{ {
public static AppManager Instance { get; private set; } public static AppManager Instance { get; private set; }