diff --git a/DangerousD/Content/animations/ZombieMoveRight b/DangerousD/Content/animations/ZombieMoveRight new file mode 100644 index 0000000..91368de --- /dev/null +++ b/DangerousD/Content/animations/ZombieMoveRight @@ -0,0 +1 @@ +{"id":"ZombieMoveRight","textureName":"animation1","startSpriteRectangle":{"X":1,"Y":9,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":4,"isCycle":true} diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/CoreEnemy.cs b/DangerousD/GameCore/GameObjects/LivingEntities/CoreEnemy.cs new file mode 100644 index 0000000..52b684b --- /dev/null +++ b/DangerousD/GameCore/GameObjects/LivingEntities/CoreEnemy.cs @@ -0,0 +1,39 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DangerousD.GameCore.GameObjects.LivingEntities +{ + public abstract class CoreEnemy : LivingEntity + { + protected int monster_health; + protected int monster_speed; + protected string name; + protected bool isAlive = true; + + public CoreEnemy(Vector2 position) : base(position) + { + //здесь я не понял + } + + public override void Update(GameTime gameTime) + { + if (monster_health <= 0) + { + Death(); + } + base.Update(gameTime); + } + public abstract void Death(); + + public abstract void Attack(); + + public abstract void Move(); + } +} diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Enemy1.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Enemy1.cs deleted file mode 100644 index ccebca0..0000000 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Enemy1.cs +++ /dev/null @@ -1,30 +0,0 @@ -using DangerousD.GameCore.Graphics; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DangerousD.GameCore.GameObjects.LivingEntities -{ - public class Enemy1 : LivingEntity - { - - protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "IDLE", "WALK" }, "IDLE"); - - public Enemy1(Vector2 position) : base(position) - { - } - - public override void Update(GameTime gameTime) - { - if (GraphicsComponent.GetCurrentAnimation!="WALK") - GraphicsComponent.StartAnimation("WALK"); - - base.Update(gameTime); - } - } -} diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs new file mode 100644 index 0000000..8b38332 --- /dev/null +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs @@ -0,0 +1,47 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters +{ + public class Zombie : CoreEnemy + { + public Zombie(Vector2 position) : base(position) + { + Width = 24; + Height = 40; + GraphicsComponent.StartAnimation("ZombieMoveRight"); + } + protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "ZombieMoveRight"}, "ZombieMoveRight"); + + public override void Update(GameTime gameTime) + { + Move(); + if (monster_health <= 0) + { + Death(); + } + base.Update(gameTime); + } + + public override void Attack() + { + + } + + public override void Death() + { + + } + + public override void Move() + { + } + } +} diff --git a/DangerousD/GameCore/Levels/Level1.cs b/DangerousD/GameCore/Levels/Level1.cs index 781bb24..bae0eee 100644 --- a/DangerousD/GameCore/Levels/Level1.cs +++ b/DangerousD/GameCore/Levels/Level1.cs @@ -1,6 +1,8 @@ using DangerousD.GameCore.GameObjects.LivingEntities; using DangerousD.GameCore.GameObjects.MapObjects; using Microsoft.Xna.Framework; +using DangerousD.GameCore.GameObjects.LivingEntities.Monsters; + namespace DangerousD.GameCore.Levels { @@ -11,7 +13,7 @@ namespace DangerousD.GameCore.Levels //new Player(); var Трава = new GrassBlock(new Vector2(0, 128)); var Death = new TestAnimationDeath(new Vector2(128, 128)); - + var Zombie = new Zombie(new Vector2(256, 128)); } } }