add register game objects
This commit is contained in:
parent
37b8623b6c
commit
eef6e038b8
7 changed files with 30 additions and 13 deletions
|
@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
|||
namespace ZoFo.GameCore.GameManagers
|
||||
{
|
||||
public enum ScopeState { Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight }
|
||||
|
||||
public class InputManager
|
||||
{
|
||||
public delegate void Delegat();
|
||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
|
|
@ -16,8 +16,10 @@ namespace ZoFo.GameCore.GameObjects.Entities
|
|||
protected Entity(Vector2 position) : base(position)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,20 +3,26 @@ using Microsoft.Xna.Framework.Graphics;
|
|||
using System;
|
||||
using ZoFo.GameCore.GameObjects.Entities;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
||||
public class LivingEntity : Entity
|
||||
{
|
||||
public Vector2 velocity;
|
||||
|
||||
private InputManager inputManager;
|
||||
|
||||
public LivingEntity(Vector2 position) : base(position)
|
||||
{
|
||||
inputManager = new InputManager();
|
||||
}
|
||||
|
||||
public void TextureLoad(SpriteBatch spriteBatch)
|
||||
#region Server side
|
||||
/*public override void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
||||
|
||||
public class Player : LivingEntity
|
||||
{
|
||||
public Vector2 InputWeaponRotation{ get; set; }
|
||||
public Vector2 InputPlayerRotation{ get; set;}
|
||||
public bool IsTryingToShoot{get;set;}
|
||||
Texture2D texture;
|
||||
private float speed;
|
||||
private int health;
|
||||
Server server = new Server();
|
||||
|
||||
public Player(Vector2 position) : base(position)
|
||||
{
|
||||
//InputWeaponRotation = new Vector2(0, 0);
|
||||
//InputPlayerRotation = new Vector2(0, 0);
|
||||
}
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
// server.AddData();
|
||||
}
|
||||
|
||||
public void TextureLoad(SpriteBatch spriteBatch)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,15 @@ using Microsoft.Xna.Framework.Graphics;
|
|||
using System;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects;
|
||||
|
||||
public abstract class GameObject
|
||||
{
|
||||
public Vector2 position;
|
||||
|
||||
private Server server;
|
||||
public Vector2 rotation; //вектор направления объекта
|
||||
protected abstract GraphicsComponent graphicsComponent { get; }
|
||||
|
||||
|
@ -17,6 +20,8 @@ public abstract class GameObject
|
|||
public GameObject(Vector2 position)
|
||||
{
|
||||
this.position = position;
|
||||
server = new Server();
|
||||
server.RegisterEntity(this);
|
||||
}
|
||||
public virtual void UpdateLogic(GameTime gameTime)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace ZoFo.GameCore
|
|||
networkManager.CloseConnection();
|
||||
}
|
||||
|
||||
private List<GameObject> gameObjects;
|
||||
private List<GameObject> gameObjects = new List<GameObject>();
|
||||
private List<Entity> entities; //entity
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue