Working Version
This commit is contained in:
parent
a1d209ba37
commit
784deabe9b
2 changed files with 23 additions and 18 deletions
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)));
|
||||||
}
|
}
|
||||||
|
@ -193,7 +191,7 @@ namespace ZoFo.GameCore
|
||||||
sourceRectangle = new SerializableRectangle((gameObject as StopObject).sourceRectangle),
|
sourceRectangle = new SerializableRectangle((gameObject as StopObject).sourceRectangle),
|
||||||
Size = new SerializablePoint((gameObject as StopObject).graphicsComponent.ObjectDrawRectangle.Size),
|
Size = new SerializablePoint((gameObject as StopObject).graphicsComponent.ObjectDrawRectangle.Size),
|
||||||
tileSetName = ((gameObject as StopObject).graphicsComponent as StaticGraphicsComponent)._textureName,
|
tileSetName = ((gameObject as StopObject).graphicsComponent as StaticGraphicsComponent)._textureName,
|
||||||
collisions = (gameObject as StopObject).collisionComponents.Select(x=>new SerializableRectangle(x.stopRectangle)).ToArray()
|
collisions = (gameObject as StopObject).collisionComponents.Select(x => new SerializableRectangle(x.stopRectangle)).ToArray()
|
||||||
});//TODO
|
});//TODO
|
||||||
foreach (var col in (gameObject as StopObject).collisionComponents)
|
foreach (var col in (gameObject as StopObject).collisionComponents)
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -247,7 +251,7 @@ namespace ZoFo.GameCore
|
||||||
if (players.Contains(entity))
|
if (players.Contains(entity))
|
||||||
players.Remove(entity as Player);
|
players.Remove(entity as Player);
|
||||||
AddData(new UpdateGameObjectDeleted()
|
AddData(new UpdateGameObjectDeleted()
|
||||||
{ GameObjectType = entity.GetType().Name, IdEntity = entity .Id}
|
{ GameObjectType = entity.GetType().Name, IdEntity = entity.Id }
|
||||||
);
|
);
|
||||||
collisionManager.Deregister(entity.collisionComponent);
|
collisionManager.Deregister(entity.collisionComponent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue