From 68b7481813d7f7ea51bbc002e7dd4c4a51427f5f Mon Sep 17 00:00:00 2001 From: bmvolf Date: Thu, 17 Aug 2023 10:56:50 +0300 Subject: [PATCH] edited animations --- .../GameCore/GameObjects/LivingEntities/Player/Player.cs | 5 +++++ DangerousD/GameCore/Graphics/GraphicsComponent.cs | 7 +++++-- DangerousD/GameCore/Managers/AppManager.cs | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 3c8e320..cd23ad2 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -16,6 +16,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { Width = 32; Height = 64; + GraphicsComponent.actionOfAnimationEnd += () => + { + AppManager.Instance.ChangeGameState(GameState.GameOver); + }; } public bool IsAlive { get { return isAlive; } } @@ -31,6 +35,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities if(monsterName == "Zombie") { DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName); + GraphicsComponent.actionOfAnimationEnd(); } isAlive = false; } diff --git a/DangerousD/GameCore/Graphics/GraphicsComponent.cs b/DangerousD/GameCore/Graphics/GraphicsComponent.cs index e4eb390..6e60b29 100644 --- a/DangerousD/GameCore/Graphics/GraphicsComponent.cs +++ b/DangerousD/GameCore/Graphics/GraphicsComponent.cs @@ -10,7 +10,7 @@ namespace DangerousD.GameCore.Graphics { public class GraphicsComponent { - //public Action actionOfAnimationEnd; + public Action actionOfAnimationEnd; private List animations; private List textures; private List texturesNames; @@ -116,7 +116,10 @@ namespace DangerousD.GameCore.Graphics if (!currentAnimation.IsCycle) { currentAnimation = neitralAnimation; - //actionOfAnimationEnd(); + if(actionOfAnimationEnd != null) + { + actionOfAnimationEnd(); + } } currentFrame = 0; diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index dc44ba9..ab061b9 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -13,7 +13,7 @@ using DangerousD.GameCore.Managers; 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 static AppManager Instance { get; private set; }