diff --git a/ZoFo/GameCore/GameObjects/Entities/Entity.cs b/ZoFo/GameCore/GameObjects/Entities/Entity.cs
index 10283c5..a1ab30b 100644
--- a/ZoFo/GameCore/GameObjects/Entities/Entity.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/Entity.cs
@@ -13,25 +13,11 @@ namespace ZoFo.GameCore.GameObjects.Entities
protected override GraphicsComponent graphicsComponent => null;
public CollisionComponent collisionComponent { get; protected set; }
public int Id { get; set; }
- public void CollisionComponent()
+ protected Entity(Vector2 position) : base(position)
{
-
- }
-
- public void AnimationComponent()
- {
-
- }
-
- public void UpdateLogic()
- {
-
}
+
}
}
-//вектор
-//вилосити
-//поситион
-//текстура
diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs
index 843258f..b900e4a 100644
--- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs
@@ -1,7 +1,10 @@
-using System;
+using Microsoft.Xna.Framework;
+using System;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
public class Collectable : Entity
{
-
+ public Collectable(Vector2 position) : base(position)
+ {
+ }
}
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs
index 9a3b320..f948689 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs
@@ -2,10 +2,13 @@
using System.Collections.Generic;
using System.Net.Mime;
using System.Reflection;
+using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies;
public class Enemy : LivingEntity
{
-
+ public Enemy(Vector2 position) : base(position)
+ {
+ }
}
\ No newline at end of file
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs
index d09be3a..05a27ec 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs
@@ -9,6 +9,9 @@ public class LivingEntity : Entity
{
public Vector2 velocity;
+ public LivingEntity(Vector2 position) : base(position)
+ {
+ }
public void TextureLoad(SpriteBatch spriteBatch)
{
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
index 39b9037..744b2c4 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
@@ -9,6 +9,10 @@ public class Player : LivingEntity
private int health;
Server server = new Server();
+ public Player(Vector2 position) : base(position)
+ {
+ }
+
public void Update(GameTime gameTime)
{
// server.AddData();
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Bullet.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Bullet.cs
index 83643f0..b72f394 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Bullet.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Bullet.cs
@@ -1,7 +1,10 @@
-using System;
+using Microsoft.Xna.Framework;
+using System;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
public class Bullet : Projectile
{
-
+ public Bullet(Vector2 position) : base(position)
+ {
+ }
}
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Projectile.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Projectile.cs
index dba7dae..3ae0f0b 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Projectile.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Projectile.cs
@@ -1,7 +1,10 @@
-using System;
+using Microsoft.Xna.Framework;
+using System;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
public class Projectile : LivingEntity
{
-
+ public Projectile(Vector2 position) : base(position)
+ {
+ }
}
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Rock.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Rock.cs
index caf91a4..fa20896 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Rock.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Projectiles/Rock.cs
@@ -1,7 +1,10 @@
-using System;
+using Microsoft.Xna.Framework;
+using System;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Projectiles;
public class Rock : Projectile
{
-
+ public Rock(Vector2 position) : base(position)
+ {
+ }
}
diff --git a/ZoFo/GameCore/GameObjects/GameObject.cs b/ZoFo/GameCore/GameObjects/GameObject.cs
index 3b9707d..d309bf9 100644
--- a/ZoFo/GameCore/GameObjects/GameObject.cs
+++ b/ZoFo/GameCore/GameObjects/GameObject.cs
@@ -18,14 +18,18 @@ public abstract class GameObject
{
this.position = position;
}
-
+ public virtual void UpdateLogic(GameTime gameTime)
+ {
+ PlayAnimation_OnServer();
+ }
+
///
/// Это вызывается в логике игры, которая на сервере, здесь будет вызываться уведомление об анимации
///
public void PlayAnimation_OnServer()
{
- //TODO
+ graphicsComponent.Update();
}
#endregion
@@ -34,22 +38,35 @@ public abstract class GameObject
#region Client Side
///
+ /// Для клиента
/// Это вызывается в клиентской части игры
///
public void PlayAnimation_OnClient()
{
graphicsComponent.Update();
}
+
+ ///
+ /// Для клиента
+ /// Загрузка графического компонента
+ ///
public void LoadContent()
{
graphicsComponent.LoadContent();
}
- public virtual void Update(GameTime gameTime)
+ ///
+ /// Для клиента
+ /// Обновление, которое вызывается у клиента, для просмотра анимаций
+ ///
+ public virtual void UpdateAnimations(GameTime gameTime)
{
- //PlayAnimation();
+ PlayAnimation_OnClient();
}
+ ///
+ /// Для клиента
+ ///
public virtual void Draw(SpriteBatch spriteBatch)
{
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch);
diff --git a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
index d3072cc..642b8fb 100644
--- a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
+++ b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs
@@ -21,6 +21,10 @@ namespace ZoFo.GameCore.GameObjects.MapObjects
_sourceRectangle = sourceRectangle;
graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0, (int)size.X, (int)size.Y);
}
-
+ public override void Draw(SpriteBatch spriteBatch)
+ {
+ graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, _sourceRectangle);
+ }
+
}
}
diff --git a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs
index 1b1d957..862c6bb 100644
--- a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs
+++ b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs
@@ -9,7 +9,7 @@ public class StopObject : MapObject
{
CollisionComponent collisionComponent;
- protected StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle) : base(position, size, sourceRectangle)
+ protected StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position, size, sourceRectangle, textureName)
{
}
}
diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs
index 48ff924..5385ce5 100644
--- a/ZoFo/GameCore/Server.cs
+++ b/ZoFo/GameCore/Server.cs
@@ -15,9 +15,7 @@ namespace ZoFo.GameCore
{
public class Server
{
- private List gameObjects;
private ServerNetworkManager networkManager;
- private List entity; //entity
public Server()
{
networkManager = new ServerNetworkManager();
@@ -57,9 +55,16 @@ namespace ZoFo.GameCore
UpdateGameEnded gameEnded = new UpdateGameEnded();
networkManager.AddData(gameEnded);
networkManager.CloseConnection();
- }
+ }
+
+ private List gameObjects;
+ private List entities; //entity
public void Update(GameTime gameTime)
- {
+ {
+ foreach (var go in gameObjects)
+ {
+ go.UpdateLogic(gameTime);
+ }
}
///