Working Version

This commit is contained in:
SergoDobro 2024-08-19 10:13:05 +03:00
parent a1d209ba37
commit 784deabe9b
2 changed files with 23 additions and 18 deletions

View file

@ -18,6 +18,7 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies
speed = 2; speed = 2;
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 30, 30); graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 30, 30);
collisionComponent.stopRectangle = new Rectangle(10, 20, 10, 10); collisionComponent.stopRectangle = new Rectangle(10, 20, 10, 10);
StartAnimation("zombie_walk");
} }
public override void Update() public override void Update()
@ -29,12 +30,12 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies
if (Random.Shared.NextDouble() > 0.9) if (Random.Shared.NextDouble() > 0.9)
{ {
StartAnimation("zombie_damaged"); StartAnimation("zombie_walk");
} }
if (Random.Shared.NextDouble() > 0.9) if (Random.Shared.NextDouble() > 0.9)
{ {
StartAnimation("zombie_idle"); //StartAnimation("zombie_idle");
} }
} }

View file

@ -137,12 +137,10 @@ namespace ZoFo.GameCore
//AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0))); //AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0)));
AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(740, 140))); AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(740, 140)));
AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1000, 1000))); for (int i = 0; i < 20; i++)
AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1300, 1000))); for (int j = 0; j < 20; j++)
AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1500, 1000))); AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1300 + i*70, 1000+j*70)));
AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1700, 1000)));
AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1900, 1000)));
AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(2100, 1000)));
AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440))); AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440)));
AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(240, 440))); AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(240, 440)));
} }
@ -214,12 +212,18 @@ namespace ZoFo.GameCore
} }
if (gameObject is Entity entity) if (gameObject is Entity entity)
{ {
AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = entity.Id, AddData(new UpdateGameObjectCreated()
position = gameObject.position}); {
GameObjectType = gameObject.GetType().Name,
IdEntity = entity.Id,
position = gameObject.position
});
collisionManager.Register(entity.collisionComponent); collisionManager.Register(entity.collisionComponent);
} }
else else
AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, AddData(new UpdateGameObjectCreated()
{
GameObjectType = gameObject.GetType().Name,
position = gameObject.position position = gameObject.position
}); });