This commit is contained in:
bmvolf 2023-08-15 15:22:52 +03:00
parent cb9b3664a4
commit f2a6cdbd8d
5 changed files with 90 additions and 31 deletions

View file

@ -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}

View file

@ -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();
}
}

View file

@ -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<string> { "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);
}
}
}

View file

@ -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<string> { "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()
{
}
}
}

View file

@ -1,6 +1,8 @@
using DangerousD.GameCore.GameObjects.LivingEntities; using DangerousD.GameCore.GameObjects.LivingEntities;
using DangerousD.GameCore.GameObjects.MapObjects; using DangerousD.GameCore.GameObjects.MapObjects;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using DangerousD.GameCore.GameObjects.LivingEntities.Monsters;
namespace DangerousD.GameCore.Levels namespace DangerousD.GameCore.Levels
{ {
@ -11,7 +13,7 @@ namespace DangerousD.GameCore.Levels
//new Player(); //new Player();
var Трава = new GrassBlock(new Vector2(0, 128)); var Трава = new GrassBlock(new Vector2(0, 128));
var Death = new TestAnimationDeath(new Vector2(128, 128)); var Death = new TestAnimationDeath(new Vector2(128, 128));
var Zombie = new Zombie(new Vector2(256, 128));
} }
} }
} }