/// <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> /// 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_Dreidels = new Dreidel[k_DreidelsNum]; m_ScoreManager = new ScoreManager(this); this.Components.Add(m_ScoreManager); // Initialing dreidels for (int i = 1; i <= k_DreidelsNum; ++i) { Dreidel newDreidel; // Every second dreidel will be Texture\Position dreidel if ((i % 2) == 0) { newDreidel = new PositionDreidel(this); } else { newDreidel = new TextureDreidel(this); } newDreidel.FinishedSpinning += new DreidelEventHandler(dreidel_FinishedSpinning); newDreidel.FinishedSpinning += new DreidelEventHandler(m_ScoreManager.Dreidel_FinishedSpinning); m_Dreidels[i - 1] = newDreidel; } m_SpinningDreidels = k_DefaultSpinningDreidelsNum; }