public void initialize(Game game, InputHandler inputHandler, ControlType controlType) { input = inputHandler; input.Initialize(); hud.Initialize(); initializeControls(controlType); level = 1; score = 0; bonus = 1; ColorData.setColors(); TextureData.setTexture(); mainGrid = new GridType(new Vector2(36, 14), new Vector2(20), 10, 19); previewGrid = new GridType(new Vector2(12, 426), new Vector2(20), 4, 2); mainGrid.initialize(); previewGrid.initialize(); random = new Random(); mainBlock = randomize(); previewBlock = randomize(); controls.initializeInput(input); input.addMotion("Pause", new Press(new Rectangle(52, 0, 160, 10))); initializeHUD(game.GraphicsDevice); fallCounter = new CounterType(data.StartSpeed); fallCounter.setEvent(Drop); accelFallCounter = new CounterType(5); accelFallCounter.setEvent(AccelDrop); movementCounter = new CounterType(5); movementCounter.setEvent(Move); updateCounter = new CounterType(30); updateCounter.setEvent(Update); bonusCounter = new CounterType(900); bonusCounter.setEvent(ReduceBonus); game.Components.Add(hud); }
public void initialize() { input.Initialize(); hud.Initialize(); switch (controlType) { case ControlType.buttons: controls = new ButtonControls(); break; case ControlType.motion: controls = new TapControls(); break; } level = 1; score = 0; bonus = 1; ColorData.setColors(); TextureData.setTexture(); mainGrid = new GridType(new Vector2(36, 14), new Vector2(20), 10, 19); previewGrid = new GridType(new Vector2(12, 426), new Vector2(20), 4, 2); mainGrid.initialize(); previewGrid.initialize(); random = new Random(); mainBlock = randomize(); previewBlock = randomize(); controls.initializeInput(input); input.addMotion("Pause", new Press(new Rectangle(52, 0, 160, 10))); initializeHUD(); dropCounter = new CounterType(gameType.StartSpeed); dropCounter.setEvent(Drop); accelDropCounter = new CounterType(5); accelDropCounter.setEvent(AccelDrop); movementCounter = new CounterType(5); movementCounter.setEvent(Move); updateCounter = new CounterType(30); updateCounter.setEvent(Update); bonusCounter = new CounterType(900); bonusCounter.setEvent(ReduceBonus); Game.Components.Add(input); Game.Components.Add(hud); }