I hope the next OP’s inquiry is not Passing my object entities and input controller to every class feels wrong : - D because sooner or later you’ll have to access your object entities, input controller, etc… across the whole application.
I’ll go with static class that handles all managers I need to access across the whole application it makes my code clean simple and shorter. static class is a life saver for every .Net developer on a certain situation like game application don’t be afraid to use it ^_^y.
I can access all my managers on a single static class like shown below :
/// <summary>
/// Global static game managers handles
/// </summary>
public static class GameMngrs
{
//*>> Content managers
static public FontContentMngr _FontMngr;
static public TextureContentMngr _TextureMngr;
static public CustomEffectContentMngr _EffectMngr;
static public MeshContentMngr _MeshMngr;
static public SoundContentMngr _SoundMngr;
//*>> Default Font;
static public FontContent _ArialFont;
//*>> 2D managers
static public LayerManager _LayerMngr;
static public ScreenManager _ScreenMngr;
static public SSpriteEntityManager _ScreenSpriteMngr;
static public TileEntityManager _TileMngr;
static public TileSpriteEntityManager _TileSpriteMngr;
static public GUIEntityManager _GUIMngr;
//*>> 3D Environment managers
static public EnvMngr _EnvMngr;
static public LightsMngr _LightsMngr;
static public SkyBoxMngr _SkyBoxMngr;
static public CameraMngr _CameraMngr;
//*>> 3D managers
static public WorldMngr _WorldMngr;
static public ModelEntityMngr _ModelMngr;
static public BillboardEntityMngr _BillboardMngr;
static public ParticleEntityMngr _ParticleMngr;
static public QuadEntityMngr _QuadMngr;
static public TrailEntityMngr _TrailMngr;
static public LineEntityMngr _LineMngr;
//*>> Input
static public Z.IO.Keyboard _KEYB;
static public Z.IO.Mouse _MOUSE;
static public Z.IO.Touch _TOUCH;
/// <summary>
/// Initialize my game global managers from game device
/// </summary>
static public void Initialize( ZGDK.GameDevice pDevice )
{
//*>> Handles content managers from game device.
_FontMngr = pDevice.Content.FontContentMngr;
_TextureMngr = pDevice.Content.TextureContentMngr;
_EffectMngr = pDevice.Content.CustomEffectContentMngr;
_MeshMngr = pDevice.Content.MeshContentMngr;
_SoundMngr = pDevice.Content.SoundContentMngr;
//*>> Handles 2D entity managers from game device.
_LayerMngr = pDevice.D2DMngr.ScreenMngr.LayerMngr;
_ScreenMngr = pDevice.D2DMngr.ScreenEntityMngr;
_ScreenSpriteMngr = pDevice.D2DMngr.ScreenMngr.SpriteEntityMngr;
_TileMngr = pDevice.D2DMngr.TileMngr;
_TileSpriteMngr = pDevice.D2DMngr.TileSpriteMngr;
_GUIMngr = pDevice.D2DMngr.GUIEntityMngr;
//*>> 3D Entity managers handles from game device.
_WorldMngr = pDevice.D3DMngr.WorldMngr;
_ModelMngr = pDevice.D3DMngr.ModelEntityMngr;
_BillboardMngr = pDevice.D3DMngr.BillboardEntityMngr;
_ParticleMngr = pDevice.D3DMngr.ParticleEntityMngr;
_QuadMngr = pDevice.D3DMngr.QuadEntityMngr;
_TrailMngr = pDevice.D3DMngr.TrialEntityMngr;
_LineMngr = pDevice.D3DMngr.LineEntityMngr;
//*>> Handle input controller from game device.
_KEYB = pDevice.InputMngr.Keyboard;
_MOUSE = pDevice.InputMngr.Mouse;
_TOUCH = pDevice.InputMngr.Touch;
}//EndMethod
}//EndNameSpace