commit
b4ea811502
4 changed files with 49 additions and 3 deletions
|
@ -22,7 +22,8 @@ using System.Linq;
|
|||
using System.Web;
|
||||
using ZoFo.GameCore.GUI;
|
||||
using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
||||
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies;
|
||||
namespace ZoFo.GameCore
|
||||
{
|
||||
public class Client
|
||||
|
@ -129,8 +130,10 @@ namespace ZoFo.GameCore
|
|||
if ((update as UpdateGameObjectCreated).GameObjectType == "Player")
|
||||
gameObjects.Add(new Player((update as UpdateGameObjectCreated).position));
|
||||
if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo")
|
||||
gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position));
|
||||
|
||||
gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)) if ((update as UpdateGameObjectCreated).GameObjectType == "Zombie")
|
||||
gameObjects.Add(new Zombie((update as UpdateGameObjectCreated).position));
|
||||
|
||||
|
||||
(gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity);
|
||||
//var a = Assembly.GetAssembly(typeof(GameObject));
|
||||
//gameObjects.Add( TODO reflection
|
||||
|
|
|
@ -8,7 +8,14 @@ using Microsoft.Xna.Framework.Content;
|
|||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies;
|
||||
public class Enemy : LivingEntity
|
||||
{
|
||||
protected float speed;
|
||||
protected int health;
|
||||
public Enemy(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies
|
||||
{
|
||||
class Zombie : Enemy
|
||||
{
|
||||
public override GraphicsComponent graphicsComponent { get; } = new("Textures/icons/8");
|
||||
public Zombie(Vector2 position) : base(position)
|
||||
{
|
||||
health = 5;
|
||||
speed =2;
|
||||
collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100);
|
||||
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 100, 100);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Vector2 duration = Vector2.Normalize(new Vector2(600 - position.X, 500 - position.Y));
|
||||
velocity=new Vector2(duration.X * speed, duration.Y*speed);
|
||||
if(position.X>595 && 605>position.X && position.Y>495 && 505>position.Y)
|
||||
{
|
||||
velocity = Vector2.Zero;
|
||||
}
|
||||
//position.X += velocity.X*t;
|
||||
//position.Y += velocity.Y * t;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -128,6 +128,7 @@ namespace ZoFo.GameCore
|
|||
|
||||
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 Zombie(new Vector2(1000, 1000)));
|
||||
AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440)));
|
||||
AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(240, 440)));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue