commit
4a04bf7b7f
7 changed files with 46 additions and 3 deletions
|
@ -12,6 +12,7 @@ using ZoFo.GameCore.GameManagers.ItemManager;
|
||||||
using ZoFo.GameCore.GUI;
|
using ZoFo.GameCore.GUI;
|
||||||
using static System.Collections.Specialized.BitVector32;
|
using static System.Collections.Specialized.BitVector32;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
|
using ZoFo.GameCore.GameManagers.AssetsManager;
|
||||||
using ZoFo.GameCore.GameObjects;
|
using ZoFo.GameCore.GameObjects;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers
|
namespace ZoFo.GameCore.GameManagers
|
||||||
|
@ -40,6 +41,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
public ItemManager.ItemManager ItemManager;
|
public ItemManager.ItemManager ItemManager;
|
||||||
public SettingsManager SettingsManager;
|
public SettingsManager SettingsManager;
|
||||||
public SoundManager SoundManager;
|
public SoundManager SoundManager;
|
||||||
|
public AssetManager AssetManager;
|
||||||
|
|
||||||
public AnimationBuilder animationBuilder { get; set; }
|
public AnimationBuilder animationBuilder { get; set; }
|
||||||
|
|
||||||
|
@ -64,6 +66,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
SettingsManager = new SettingsManager();
|
SettingsManager = new SettingsManager();
|
||||||
SettingsManager.LoadSettings();
|
SettingsManager.LoadSettings();
|
||||||
SoundManager = new SoundManager();
|
SoundManager = new SoundManager();
|
||||||
|
AssetManager = new AssetManager();
|
||||||
SoundManager.LoadSounds();
|
SoundManager.LoadSounds();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.AssetsManager;
|
||||||
|
|
||||||
|
public class AssetContainer
|
||||||
|
{
|
||||||
|
public List<string> Animations;
|
||||||
|
public string IdleAnimation;
|
||||||
|
}
|
18
ZoFo/GameCore/GameManagers/AssetsManager/AssetManager.cs
Normal file
18
ZoFo/GameCore/GameManagers/AssetsManager/AssetManager.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.AssetsManager;
|
||||||
|
|
||||||
|
public class AssetManager
|
||||||
|
{
|
||||||
|
public AssetContainer Zombie = new()
|
||||||
|
{
|
||||||
|
Animations = ["zombie_damaged", "zombie_walk", "zombie_idle", "zombie_attack", "zombie_death"],
|
||||||
|
IdleAnimation = "zombie_walk"
|
||||||
|
};
|
||||||
|
|
||||||
|
public AssetContainer Player = new()
|
||||||
|
{
|
||||||
|
Animations = [ "player_look_down" ],
|
||||||
|
IdleAnimation = "player_look_down"
|
||||||
|
};
|
||||||
|
}
|
|
@ -85,7 +85,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
var databytes = Encoding.UTF8.GetBytes(data);
|
var databytes = Encoding.UTF8.GetBytes(data);
|
||||||
foreach (Socket socket in clients)
|
foreach (Socket socket in clients)
|
||||||
{
|
{
|
||||||
clients[0].SendAsync(databytes, SocketFlags.Partial);
|
clients[0].SendAsync(databytes);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 200 && i< datasToSend.Count; i++)
|
for (int i = 0; i < 200 && i< datasToSend.Count; i++)
|
||||||
updates.RemoveAt(0);
|
updates.RemoveAt(0);
|
||||||
|
|
|
@ -5,13 +5,14 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.AssetsManager;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies
|
||||||
{
|
{
|
||||||
class Zombie : Enemy
|
class Zombie : Enemy
|
||||||
{
|
{
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "zombie_damaged", "zombie_walk", "zombie_idle", "zombie_attack", "zombie_death" }, "zombie_walk");
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(AppManager.Instance.AssetManager.Zombie);
|
||||||
public Zombie(Vector2 position) : base(position)
|
public Zombie(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
health = 5;
|
health = 5;
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.AssetsManager;
|
||||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
@ -21,7 +22,7 @@ public class Player : LivingEntity
|
||||||
//public bool IsTryingToShoot { get; set; }
|
//public bool IsTryingToShoot { get; set; }
|
||||||
private float speed;
|
private float speed;
|
||||||
private int health;
|
private int health;
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "player_look_down" }, "player_look_down");
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(AppManager.Instance.AssetManager.Player);
|
||||||
private LootData lootData;
|
private LootData lootData;
|
||||||
//public bool isTryingToInteract { get; set; }
|
//public bool isTryingToInteract { get; set; }
|
||||||
public Player(Vector2 position) : base(position)
|
public Player(Vector2 position) : base(position)
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.AssetsManager;
|
||||||
using ZoFo.GameCore.GUI;
|
using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.Graphics
|
namespace ZoFo.GameCore.Graphics
|
||||||
|
@ -60,7 +61,17 @@ namespace ZoFo.GameCore.Graphics
|
||||||
private int interval;
|
private int interval;
|
||||||
private int lastInterval;
|
private int lastInterval;
|
||||||
private Rectangle sourceRectangle;
|
private Rectangle sourceRectangle;
|
||||||
|
public AnimatedGraphicsComponent(AssetContainer asset)
|
||||||
|
{
|
||||||
|
Build(asset.Animations, asset.IdleAnimation);
|
||||||
|
}
|
||||||
|
|
||||||
public AnimatedGraphicsComponent(List<string> animationsId, string neitralAnimationId)
|
public AnimatedGraphicsComponent(List<string> animationsId, string neitralAnimationId)
|
||||||
|
{
|
||||||
|
Build(animationsId, neitralAnimationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Build(List<string> animationsId, string neitralAnimationId)
|
||||||
{
|
{
|
||||||
//this._spriteBatch = _spriteBatch;
|
//this._spriteBatch = _spriteBatch;
|
||||||
currentFrame = 0;
|
currentFrame = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue