ended work on zombie

This commit is contained in:
bmvolf 2023-08-15 18:44:41 +03:00
parent d65320f21b
commit ac1b3b6373
2 changed files with 5 additions and 3 deletions

View file

@ -12,7 +12,8 @@ namespace DangerousD.GameCore
{ {
public abstract class GameObject : IDrawableObject public abstract class GameObject : IDrawableObject
{ {
public Vector2 Pos { get; protected set; } private Vector2 _pos;
public Vector2 Pos => _pos;
public int Width { get; protected set; } public int Width { get; protected set; }
public int Height { get; protected set; } public int Height { get; protected set; }
public Rectangle Rectangle => new Rectangle((int)Pos.X, (int)Pos.Y, Width, Height); public Rectangle Rectangle => new Rectangle((int)Pos.X, (int)Pos.Y, Width, Height);
@ -21,7 +22,7 @@ namespace DangerousD.GameCore
protected abstract GraphicsComponent GraphicsComponent { get; } protected abstract GraphicsComponent GraphicsComponent { get; }
public GameObject(Vector2 pos) public GameObject(Vector2 pos)
{ {
Pos = pos; _pos = pos;
Width = 500; Width = 500;
Height = 101; Height = 101;
//Animator = new GraphicsComponent(new() { "playerIdle" }); //Animator = new GraphicsComponent(new() { "playerIdle" });

View file

@ -18,9 +18,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
Width = 72; Width = 72;
Height = 120; Height = 120;
monster_speed = 100; monster_speed = 100;
GraphicsComponent.StartAnimation("ZombieLeftAttack");
name = "Zombie"; name = "Zombie";
} }
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveRight"); protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft");
public override void Update(GameTime gameTime) public override void Update(GameTime gameTime)
{ {