public void onPlayGame(PlayGameEvent e) { switch (e.game) { case MiniGames.PumpkinCarving: transform.position = pumpkin; break; case MiniGames.CornMaze: switch (e.difficulty) { case 1: transform.position = maze1; break; case 2: transform.position = maze2; break; case 3: transform.position = maze3; break; } break; case MiniGames.AppleBobbing: transform.position = apples; break; default: transform.position = start; break; } }
public void onPlayGameEvent(PlayGameEvent e) { if (e.game != MiniGames.PumpkinCarving) { // early out return; } switch (e.difficulty) { case 1: easy.gameObject.SetActive(true); break; case 2: normal.gameObject.SetActive(true); break; case 3: hard.gameObject.SetActive(true); break; default: break; } }
public void onPlayGame(PlayGameEvent e) { if (e.game == MiniGames.CornMaze && e.difficulty == level) { // move player and camera EventBus.Publish <ShowHintText>(new ShowHintText("Escape the Corn Maze!")); EventBus.Publish <MovePlayerEvent>(new MovePlayerEvent(transform.position)); // unfreeze player EventBus.Publish <PlayerMovementEvent>(new PlayerMovementEvent(true)); } }
public void onPlayGame(PlayGameEvent e) { // Prepare the minigame ot be played by resetting variables and swapping the displayed score text if (e.game == MiniGames.AppleBobbing) { EventBus.Publish <ShowHintText>(new ShowHintText("Click on the Apples!")); currApples = 0; playing = true; appleScoreText.text = currApples.ToString() + "/" + appleTarget.ToString() + " Apples"; appleScoreText.enabled = true; difficulty = e.difficulty; currTime = 0.0f; } }
//============================================================ // Event Handlers: //============================================================ private static UnityAction ButtonsOnClick(Events eventToRaise) { // empty action to be returned later UnityAction action = null; // if the play button was clicked, return an action invoking the playgame event if (eventToRaise == Events.PlayGame) { if (PlayGameEvent != null) { action = () => { PlayGameEvent.Invoke(); }; } } // otherwise, return an action invoking the highscores event else { if (HighScoresEvent != null) { action = () => { HighScoresEvent.Invoke(); }; } } return(action); }
public void onPlayGame(PlayGameEvent e) { Debug.Log("Playing Game!"); }