/// <summary> /// Default CTOR. Initializes all dreidels /// </summary> public DreidelGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; m_InputManager = new InputManager(this); this.Components.Add(m_InputManager); this.Services.AddService(typeof(InputManager), m_InputManager); m_ScoreManager = new ScoreManager(this); this.Components.Add(m_ScoreManager); // Initialing dreidels IDreidel newDreidel; for (int i = 0; i < k_DreidelsNum; ++i) { if (i < k_DreidelsNum - 3) { // Every second dreidel will be Texture\Position dreidel newDreidel = (i % 2) == 0 ? (IDreidel) new PositionDreidel(this) : (IDreidel) new TextureDreidel(this); } else { newDreidel = (IDreidel) new ModelDreidel(this); } newDreidel.FinishedSpinning += new DreidelEventHandler(dreidel_FinishedSpinning); newDreidel.FinishedSpinning += new DreidelEventHandler(m_ScoreManager.Dreidel_FinishedSpinning); m_Dreidels[i] = newDreidel; } m_SpinningDreidels = k_DefaultSpinningDreidelsNum; m_Camera = new Camera(this); this.Components.Add(m_Camera); this.Services.AddService(typeof(Camera), m_Camera); }
/// <summary> /// Initialize the camera member from the games services list /// </summary> public override void Initialize() { base.Initialize(); m_Camera = Game.Services.GetService(typeof(Camera)) as Camera; }