feat: IMonoGameContentLoader
This commit is contained in:
parent
8a0a0289f9
commit
b1582ab5c2
|
@ -0,0 +1,8 @@
|
|||
using Microsoft.Xna.Framework.Content;
|
||||
|
||||
namespace Pong.Behaviours;
|
||||
|
||||
public interface IMonoGameContentLoader
|
||||
{
|
||||
void LoadContent(ContentManager content);
|
||||
}
|
|
@ -27,6 +27,7 @@ public class GamePong : Game
|
|||
private GameManager gameManager = null!;
|
||||
private BehaviourCacher<IDisplayableSprite> displayableCacher = null!;
|
||||
private BehaviourCacher<IDisplayableShape> displayableShapeCacher = null!;
|
||||
private BehaviourCacher<IMonoGameContentLoader> monoGameContentLoaderCacher = null!;
|
||||
private MonoGameCamera2DBehaviour cameraBehaviour = null!;
|
||||
|
||||
private PongManagerBehaviour pongManager = null!;
|
||||
|
@ -52,6 +53,7 @@ public class GamePong : Game
|
|||
gameManager = new();
|
||||
displayableCacher = new(gameManager);
|
||||
displayableShapeCacher = new(gameManager);
|
||||
monoGameContentLoaderCacher = new(gameManager);
|
||||
physicsEngine = new PhysicsEngine2DCacher(gameManager) { IterationPerStep = 3 };
|
||||
|
||||
gameManager.Initialize();
|
||||
|
@ -154,6 +156,11 @@ public class GamePong : Game
|
|||
pongManager.BehaviourController.AddBehaviour<NetworkClient>().Connect("127.0.0.1", 8888);
|
||||
Window.Title = $"Pong - Client -> 127.0.0.1";
|
||||
}
|
||||
|
||||
foreach (var contentLoader in monoGameContentLoaderCacher)
|
||||
{
|
||||
contentLoader.LoadContent(Content);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update(GameTime gameTime)
|
||||
|
|
Loading…
Reference in New Issue