public void switchMinigame(object o, EventArgs e) { Console.WriteLine("Switching now!"); if (currentController is StandbyController) { int randomControllerIndex = randomGenerator.Next(minigameControllers.Count); Minigame minigameToSwitchTo = minigameFactory.getMinigameOfType(MINIGAME_TYPE.Association); ((StandbyController)currentController).setInstructionText(minigameToSwitchTo.getDescription()); instructionDisplayTimer.Start(); switch (randomControllerIndex) { case 0: currentController = new CarStopperController(minigameToSwitchTo); break; case 1: currentController = new PopTheBubblesController(minigameToSwitchTo); break; case 2: currentController = new NetGameController(minigameToSwitchTo); break; } //currentController = //new CarStopperController(minigameFactory.getMinigameOfType(MINIGAME_TYPE.Association)); } else { currentController = new StandbyController(); this.Content = currentController; } currentController.ControllerFinished += switchMinigame; }
private void Window_Loaded(object sender, RoutedEventArgs e) { instructionDisplayTimer = new System.Windows.Threading.DispatcherTimer(); instructionDisplayTimer.Interval = TimeSpan.FromMilliseconds(3000); instructionDisplayTimer.Tick += SwitchController; instructionDisplayTimer.IsEnabled = false; minigameFactory = new MinigameFactory(); minigameFactory.mainController = this; currentController = new StandbyController(); currentController.ControllerFinished += switchMinigame; currentController.parentController = this; this.Content = currentController; minigameControllers = new List<Type>(); minigameControllers.Add(typeof(CarStopperController)); minigameControllers.Add(typeof(PopTheBubblesController)); minigameControllers.Add(typeof(NetGameController)); SetupKinect(); }