public async Task Inventory() { var user = Context.User; var messageChannel = Context.Channel; await MiniGame.ShowInventory(user, messageChannel); }
public async Task Search() { var user = Context.User; var messageChannel = Context.Channel; await MiniGame.Search(user, messageChannel); }
public async Task Resurrect() { var user = Context.User; var messageChannel = Context.Channel; await MiniGame.TryResurrect(user, messageChannel); }
public async Task NewPlayer() { var user = Context.User; var messageChannel = Context.Channel; await MiniGame.NewPlayer(user, messageChannel); }
void onMiniGameWon(MiniGame miniGame) { if (reduceOnHand(miniGame.targetCandy)) { EmitSignal(nameof(CandyMoved)); } }
public void UnloadScene(MiniGame miniGame) { string miniGameName = miniGame.name; Destroy(miniGame.gameObject); if (OnSceneUnloaded != null) OnSceneUnloaded(miniGameName); }
public (string title, int stars, string status, int highScore) getGameDetail(int gameID) { string title = ""; int stars = 0; string status = ""; int highScore = 0; if (miniGames != null && gameID < miniGames.Length) { MiniGame game = miniGames[gameID]; title = game.getTitle(); stars = game.getStars(); highScore = game.getHighScore(); if (game.isCompleted()) { status = "gefunden"; } else { status = "verschollen"; } } return(title, stars, status, highScore); }
// void OnTriggerEnter2D(Collider2D other) // { // PlayableCharacter playableCharacter_temp = other.GetComponent<PlayableCharacter>(); // if (playableCharacter_temp && ApplicableCharacters.Contains(playableCharacter_temp.PlayerType)) // { // buttonInstance.SetActive(true); // PatternButtonAnim.SetTrigger(MiniGame.ButtonAnimations[XboxButton.A]); //// if (CharPos) //// { //// playableCharacter.disableMovement(); //// playableCharacter.transform.position = CharPos.position; //// playableCharacter.PlayerController.isRight = CharFacingRight; //// } //// MiniGameScript.StartMiniGame(this, playableCharacter); // } // } private void OnTriggerStay2D(Collider2D other) { if (MiniGameScript.inMiniGame || (_brokenMiniGame.CanBeBroke && _brokenMiniGame.BrokenMiniGameScript.inMiniGame)) { return; } PlayableCharacter playableCharacter_temp = other.GetComponent <PlayableCharacter>(); if (!playableCharacter_temp) { return; } if (!IsBroken) { if (state == State.READY && ApplicableCharacters.Contains(playableCharacter_temp.PlayerType)) { currentMiniGameInPlay = MiniGameScript; EnterMiniGame(currentMiniGameInPlay, playableCharacter_temp); } } else { if (playableCharacter_temp.PlayerType == GameManager.PlayerType.Dad) { currentMiniGameInPlay = _brokenMiniGame.BrokenMiniGameScript; EnterMiniGame(currentMiniGameInPlay, playableCharacter_temp); } } }
public static void start(Viewport root, Player thePlayer, NPC theNPC, Candy theCandy, int startingPrice = 0, string scene = "res://scenes/minigames/MiniGame.tscn") { PackedScene mg_scene = GD.Load <PackedScene>(scene); MiniGame mg_node = mg_scene.Instance() as MiniGame; mg_node.startMiniGame(root, thePlayer, theNPC, theCandy, startingPrice); }
public void loadState() { Debug.Log("File lists: " + System.IO.Directory.GetCurrentDirectory()); if (System.IO.File.Exists("gameState.txt")) { string[] jsons = System.IO.File.ReadAllLines("gameState.txt"); blanketGame = JsonUtility.FromJson <MiniGame> (jsons[0]); Debug.Log("Successfully loaded blanket game state"); Debug.Log(GameObject.Find("GameState").GetComponent <GameState> ().blanketGame.gameName + "Blanket game unlocked: " + GameObject.Find("GameState").GetComponent <GameState> ().blanketGame.isUnlocked()); jobHuntGame = JsonUtility.FromJson <MiniGame> (jsons[1]); foodGame = JsonUtility.FromJson <MiniGame> (jsons[2]); player_pos = JsonUtility.FromJson <Vector3> (jsons[3]); } else { blanketGame = new MiniGame(BlanketGame); jobHuntGame = new MiniGame(JobHuntGame); foodGame = new MiniGame(FoodGame); player_pos = Vector3.zero; } if (GameObject.Find("Player") != null) { GameObject.Find("Player").transform.position = player_pos; } }
public void UnloadScene(MiniGame miniGame) { string miniGameName = miniGame.name; StartCoroutine(UnloadNextFrame(miniGameName)); if (OnSceneUnloaded != null) OnSceneUnloaded(miniGameName); }
private void ShowGameIcon(GameObject prefab) { MiniGame miniGame = null; for (int i = 0; i < GameProgress.miniGames.Length; i++) { if (GameProgress.miniGames[i].getTitleKey() == prefab.name) { miniGame = GameProgress.miniGames[i]; } } if (miniGame != null && miniGame.isCompleted()) { prefab.transform.Find("completed").gameObject.SetActive(true); Animator animator = prefab.transform.Find("completed").Find("marker_pulse_completed").GetComponent <Animator>(); animator.enabled = true; animator.Play("pulse-succ"); prefab.transform.Find("not-completed").gameObject.SetActive(false); } else { prefab.transform.Find("completed").gameObject.SetActive(false); prefab.transform.Find("not-completed").gameObject.SetActive(true); } }
private void Awake() { _minigame = transform.GetComponent <MiniGame_Meteorfall>(); List <PlayerInput> playerInputs = new List <PlayerInput>(4) { _player1.GetComponent <PlayerInput>(), _player2.GetComponent <PlayerInput>(), _player3.GetComponent <PlayerInput>(), _player4.GetComponent <PlayerInput>() }; List <string> ids = new List <string>(4) { "0", "1", "2", "3" }; bool player1_AI = PlayerPrefs.GetString("Player1_AI").Equals("True"); bool player2_AI = PlayerPrefs.GetString("Player2_AI").Equals("True"); bool player3_AI = PlayerPrefs.GetString("Player3_AI").Equals("True"); bool player4_AI = PlayerPrefs.GetString("Player4_AI").Equals("True"); player3_AI = true; player4_AI = true; player2_AI = true; player1_AI = true; AssignAI(player1_AI, player2_AI, player3_AI, player4_AI); //InputManager.Instance.AssignPlayerInput(playerInputs); // Stops execution of this monobehaviour in absence of playerprefs //InputManager.Instance.AssignPlayerInput(playerInputs, ids); // Right Version when Playerprefs work correctly }
public void UpdateMiniGame(MiniGame miniGame) { int indexMiniGame = miniGames.FindIndex(x => x.Id == miniGame.Id); miniGames[indexMiniGame] = miniGame; SaveData(); }
//return a list of all minigames in the database public List <MiniGame> GetAllMinigames() { List <MiniGame> miniGames = new List <MiniGame>(); using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Aura"].ConnectionString)) { using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandText = "SELECT * FROM MiniGames"; command.Connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { MiniGame code = new MiniGame(); code.ID = (int)reader["MiniGameID"]; code.MiniGameCategoryID = (int)reader["MiniGameCategoryID"]; code.MiniGamePath = reader["MiniGamePath"].ToString(); code.MiniGameName = reader["MiniGameName"].ToString(); code.MinDifficulty = (int)reader["MinDifficulty"]; code.MaxDifficulty = (int)reader["MaxDifficulty"]; miniGames.Add(code); } } } } return(miniGames); }
private void loadMiniGame(dynamic miniGameRes, MiniGame miniGame) { miniGame.Index = miniGameRes.Index; miniGame.Level = miniGameRes.Level; miniGame.LevelRestriction = miniGameRes.LevelRestriction; miniGame.GameMode = GameMode.Parse(miniGameRes.GameMode); }
public void SetupMinigame(DialogScene scene) { minigameFinished = false; scene.minigame.SetActive(true); _miniGame = scene.minigame.GetComponent <MiniGame>(); _miniGame.OnMinigameFinished += () => minigameFinished = true; }
/* PRIVATE METHODS */ private void SpawnNewMiniGame() { float delay = 0f; // Clear game data. _currentGame?.Cleanup(); _currentGame = null; // Clear input panel first. for (int i = 0; i < _inputActionPanel.childCount; i++) { RectTransform rt = _inputActionPanel.GetChild(i) as RectTransform; rt.DOScale(Vector3.zero, 0.35f).SetEase(Ease.InBack).OnComplete(() => Destroy(rt.gameObject)); } delay += (_inputActionPanel.childCount == 0) ? 0f : 0.4f; DOTween.Sequence().InsertCallback(delay, () => { _currentGameType = (Constants.GameType)Random.Range(0, (int)Constants.GameType.AllTypes); _currentGameType = Constants.GameType.Yoga; _currentGame = _miniGameFactory.CreateMiniGame(Constants.GameType.Yoga); _updateMinigame = true; _instructions.text = _currentGame.Instructions; ShowNextInput(_currentGame.GetType()); }); }
public void EndMiniGame(int winnerBoxId, MiniGame type, bool isOnlyWinner) { MapTriggerBox box = MapEntityMetadataStorage.GetTriggerBox(Field.MapId, winnerBoxId); if (box is null) { return; } foreach (IFieldObject <Player> player in Field.State.Players.Values) { if (!FieldManager.IsPlayerInBox(box, player)) { continue; } switch (type) { case MiniGame.LudibriumEscape: PlayerTrigger trigger = player.Value.Triggers.FirstOrDefault(x => x.Key == "gameStart"); player.Value.Triggers.Remove(trigger); player.Value.Session.Send(ResultsPacket.Rounds(1, 1)); break; case MiniGame.OXQuiz: player.Value.Session.Send(ResultsPacket.Rounds(10, 10)); break; } } }
public Emotion(string name, string description, MiniGame game, AudioClip audioDescription) { this.name = name; this.description = description; this.game = game; this.audioDescription = audioDescription; }
public void MiniGameGiveReward(int winnerBoxId, string contentType, MiniGame type) { MapTriggerBox box = MapEntityStorage.GetTriggerBox(Field.MapId, winnerBoxId); List <IFieldObject <Player> > players = new List <IFieldObject <Player> >(); foreach (IFieldObject <Player> player in Field.State.Players.Values) { if (FieldManager.IsPlayerInBox(box, player)) { players.Add(player); } } foreach (IFieldObject <Player> player in players) { if (contentType == "miniGame") { List <Item> items = RewardContentMetadataStorage.GetRewardItems(3, player.Value.Levels.Level); foreach (Item item in items) { InventoryController.Add(player.Value.Session, item, true); } } else if (contentType == "UserOpenMiniGameExtraReward") { } } }
public void SetMiniGame(MiniGame miniGame) { if (GetMinigameDisplay(miniGame, out Display display)) { //set video player settings renderImage.texture = display.renderTexture; videoPlayer.clip = display.videoClip; videoPlayer.targetTexture = display.renderTexture; videoPlayer.Play(); //set text displays txtHeader.text = display.Header; txtSubHeader.text = display.SubHeader; //set intro button settings introButton.SetIntroduction(display.Intro); //set load button settings foreach (GameObject button in loadbuttons) { LoadMiniGameButton loader = button.GetComponent <LoadMiniGameButton>(); loader.SetSetting(display.Setting, true); loader.NameOfSceneLoading = display.Setting.NameOfScene; MinigameDifficultyButton difficulty = button.GetComponent <MinigameDifficultyButton>(); difficulty.SetSetting(display.Setting); } } }
// setup of all mini games public void InitializeGameData(bool forced = false) { if (miniGames == null || forced) { Sprite sp = Resources.Load <Sprite>("Sprites/tower"); starsCollected = 0; MarkerTracking.airPlaneStarCollected = false; MarkerTracking.oldImagesStarCollected = false; MarkerTracking.museStarCollected = false; MarkerTracking.productsStarCollected = false; MarkerTracking.historyStarCollected = false; //Initialize Ingredients Ingredient lemon = new Ingredient(0, "Zitrone", Resources.Load <Sprite>("Sprites/Ingredients/lemon-active"), Resources.Load <Sprite>("Sprites/Ingredients/lemon-inactive"), Resources.Load <Material>("Materials/Success/lemon")); Ingredient hazelnut = new Ingredient(1, "Haselnuss", Resources.Load <Sprite>("Sprites/Ingredients/hazelnut-active"), Resources.Load <Sprite>("Sprites/Ingredients/hazelnut-inactive"), Resources.Load <Material>("Materials/Success/hazelnut")); Ingredient flour = new Ingredient(2, "Mehl", Resources.Load <Sprite>("Sprites/Ingredients/flour-active"), Resources.Load <Sprite>("Sprites/Ingredients/flour-inactive"), Resources.Load <Material>("Materials/Success/flour")); Ingredient honey = new Ingredient(3, "Honig", Resources.Load <Sprite>("Sprites/Ingredients/honey-active"), Resources.Load <Sprite>("Sprites/Ingredients/honey-inactive"), Resources.Load <Material>("Materials/Success/honey")); //Initialize MiniGames miniGames = new MiniGame[numberOfGames]; miniGames[0] = new MiniGame(0, "laeckerli-tower", "Läckerli Turm", "Baue einen Turm mit Läckerli indem du sie aufeinander stapelst.", 0, 0, lemon); miniGames[1] = new MiniGame(1, "find-alex", "Finde Alex", "Hilf mir Alex zu finden. Du kannst zusätzliche Sterne verdienen, wenn du genau herumschaust und auch den anderen hilfst.", 0, 0, flour); miniGames[2] = new MiniGame(2, "combination", "Kombiniere richtig", "Setze die einzelnen Stücke zusammen, indem du die Karten richtig drehst und zusammensetzt.", 0, 0, hazelnut); miniGames[3] = new MiniGame(3, "maze", "Küchen Minigolf", "Spiele Minigolf in unserer Küche.", 0, 0, honey); Debug.Log("Creating new MiniGame Array"); } }
/// <name> /// Start /// </name> /// <summary> /// Use this for initialization /// </summary> /// <author> /// Sabrina Hemming /// </author> /// <date> /// 2/12/18 /// </date> void Start() { // get access to script on Chest and Coin object to play it's animation coinScript = coinGO.GetComponent <PlayAnimation> (); chestScript = chestGO.GetComponent <PlayAnimation> (); // get access to saved addition game info to update gameStats = gameStatsGO.GetComponent <GlobalControl> (); additionGame = gameStats.savedGameData.addition; // add a listener for when user clicks enter button enterButton .onClick .AddListener(CheckAnswer); // add a listener for when user clicks exit button exitButton .onClick .AddListener(ExitGame); // get the input field as a game object and an input field object GameObject inputFieldGO = GameObject.Find(Constants.INPUT); InputFieldCO = inputFieldGO.GetComponent <InputField> (); isFocused = false; score.text = additionGame.correctAnswers.ToString(); // get the first math equation and set the text equation = new MathEquation(additionGame.increaseRange, additionGame.level, MathEquation.EquationType.Addition); mathProblem.text = equation.EquationString; }
private IReadOnlyList <Table> TestData(MiniGame game) { var tables = new List <Table>(100); for (int t = 0; t < tables.Capacity; ++t) { var table = new Table() { localID = t, chair = 8, game = game, isPlaying = true, money = 123456, password = "******" }; tables.Add(table); var list = new List <TablePlayer>(); for (int i = 0; i < 8; ++i) { list.Add(new TablePlayer() { table = table, user = new User() { sex = (User.Sex)(i % 2) } }); } //table.players = list; table.host = list[0]; } return(tables); }
private void UnloadMiniGame(MiniGame game) { string sceneName = ""; switch (game) { case MiniGame.StompBug: sceneName = "StompBug"; break; case MiniGame.SmashBug: sceneName = "SmashBug"; break; case MiniGame.PaintBug: sceneName = "PaintBug"; break; case MiniGame.Piano: sceneName = "Pinao"; break; } SceneManager.UnloadSceneAsync(sceneName); }
//get a list of playable minigames based on category and difficulty public List <MiniGame> GetListPlayable(int categoryID, int difficulty) { List <MiniGame> miniGames = new List <MiniGame>(); using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Aura"].ConnectionString)) { using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandText = "SELECT * FROM MiniGames WHERE MiniGameCategoryID=@categoryID AND MinDifficulty <= @difficulty AND MaxDifficulty >= @difficulty"; command.Parameters.AddWithValue("@categoryID", categoryID); command.Parameters.AddWithValue("@difficulty", difficulty); command.Connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { MiniGame code = new MiniGame(); code.ID = (int)reader["MiniGameID"]; code.MiniGameCategoryID = (int)reader["MiniGameCategoryID"]; code.MiniGamePath = reader["MiniGamePath"].ToString(); code.MiniGameName = reader["MiniGameName"].ToString(); code.MinDifficulty = (int)reader["MinDifficulty"]; code.MaxDifficulty = (int)reader["MaxDifficulty"]; miniGames.Add(code); } } } } return(miniGames); }
void Start() { pV = transform.GetComponent <PhotonView>(); rb = GetComponent <Rigidbody>(); game = FindObjectOfType <MiniGame>(); speed = moveSpeed; jumpVel = jumpVelocity; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; camDefaultPos = cam.transform.localPosition; if (!pV.IsMine) { cam.gameObject.SetActive(false); modelHeadless.SetActive(false); anim = model.GetComponent <Animator>(); } else { model.SetActive(false); anim = modelHeadless.GetComponent <Animator>(); } players = FindObjectsOfType <PlayerController>().ToList(); nickName = pV.Owner.NickName; UpdateNames(); }
public void Initialize(MiniGame gameToLaunch) { m_CurrentMiniGame = gameToLaunch; m_IsStarting = false; m_GameImage.sprite = m_CurrentMiniGame.data.image; m_GameDescription.text = m_CurrentMiniGame.data.description; m_GameTitle.text = m_CurrentMiniGame.data.title; }
public void StopMiniGame() { // Останавилваем мини игру game.Destroy(); game = null; startScreen.gameObject.SetActive(true); }
private void ActivateMiniGame() { audioS.PlayOneShot(miniGameAppearing); myMiniGame = Instantiate(miniGame, Vector3.zero, Quaternion.identity); GameManager.Instance.isPlaying = true; myMiniGame.associatedTroll = this; }
public static string GetSceneNameFromMinigame(MiniGame _minigame) { if (_minigame == MiniGame.KickThemAll) { return("SceneMinigamePush"); } return(""); }
void Awake() { Instance = this; if (LoadingMgr.Instance == null) { PlayerPrefs.SetString("minigame_to_test", name); SceneManager.LoadScene("main"); return; } LoadingMgr.Instance.MiniGameLoaded(this); }
public MiniGame CreateNewMiniGame(GameType gameType) { MiniGame game = null; switch(gameType){ case GameType.PLATFORM: game = new MiniGame(gameType); break; case GameType.SUMO : game = new SumoMiniGame(gameType); break; } minigames.Add(game.gameId, game); currentMiniGames[(int)gameType] = game; return game; }
public void Start() { g = null; life = 3; score = 0; timeFactor = 1; gamesCompleted = 0; timeToWait = 2.5f; lastGame = -1; mg = GameObject.FindGameObjectWithTag("GameController").GetComponent<MainGame>(); gameObject.tag = "Game"; }
private void OnMiniGameLostLife(MiniGame miniGame) { numLives--; Debug.Log("Lost life!"); for (int i = 0; i < miniGames.Length; i++) { if (miniGames[i].gameObject.activeSelf) miniGames[i].NotifyLifeTotalChanged(numLives); } if (numLives == 0) { Debug.Log("You Lose!"); EndSceneLogic.score = Time.time - startTime; Application.LoadLevel("EndScene"); } }
void Awake() { Instance = this; }
public void MiniGameLoaded(MiniGame minigame) { OnSceneLoaded(minigame); minigame.gameObject.SetActive(false); }
private void Update() { AudioSource audio = GetComponent<AudioSource> (); switch (state) { case State.WAITING: waitTime += Time.deltaTime; if (waitTime > timeToWait) state = State.LOADING; break; case State.LOADING: g = GetGame(); g.StartGame(timeFactor); addAudio(); state = State.RUNNING; break; case State.RUNNING: switch (g.GetState()) { case MiniGame.State.RUNNING: break; case MiniGame.State.WON: score += g.Score; gamesCompleted ++; CalculateTimeFactor(); g.Destroy(); g = null; audio.clip = win; audio.Play (); state = State.WAITING; waitTime = 0; break; case MiniGame.State.LOST: life --; if (life == 0) GameOver(); g.Destroy(); g = null; audio.clip = lose; audio.Play (); state = State.WAITING; waitTime = 0; break; } break; } }
// Use this for initialization void Start() { //Initialize timer with 1 second intervals currentGame = gameObject.GetComponentInChildren<GameBase>(); instance = this; }
void Awake() { instance = this; }
// Use this for initialization void Awake () { miniGame = GetComponent<MiniGame>(); }
/// <summary> /// Checks if the game is unlocked /// </summary> /// <returns><c>true</c>, if unlocked was ised, <c>false</c> otherwise.</returns> /// <param name="minigame">Minigame.</param> bool isUnlocked(MiniGame minigame) { return minigame.isUnlocked(currentStage); }
/// <summary> /// Starts the minigame /// </summary> /// <param name="GameNumber">Game number of the game to be started</param> void StartGame(int GameNumber) { //MoveCamera (gameNumber); currentMinigame = (MiniGame)Instantiate (GetGame(GameNumber), new Vector3 (0, 0, -10), Quaternion.identity); //currentMinigame = GetGame(GameNumber); //currentMinigame.gameObject.SetActive(true); StartCoroutine(currentMinigame.StartMinigame(GetDifficulty(), /*!hasPlayed(currentMinigame.title)*/ true)); }
public override void Init(params object[] args) { item = null; moodItem = null; IsTechnology = (bool)args[1]; Window = args[2].ToString(); if (IsTechnology) { var shopItem = (TechnologyItemJeka3)args[0]; if (shopItem == null) { return; } item = shopItem; Price.text = "Купить за " + shopItem.Cost; Caption.text = item.Name; Text.text = !string.IsNullOrEmpty(item.Description) && item.Description != " " ? item.Description : "Описание"; if (item.DescriptionSize == 0) { Text.gameObject.transform.localScale = new Vector3(22, 22, 1); } else { Text.gameObject.transform.localScale = new Vector3(item.DescriptionSize, item.DescriptionSize, 1); } Sprite.spriteName = item.Texture; var rect1 = Sprite.atlas.GetSprite(item.Texture); if (rect1 != null) { var rect = rect1.outer; if (rect.width > 200) { Sprite.gameObject.transform.localScale = new Vector3(200, rect.height * (200 / rect.width), 0); } else { Sprite.gameObject.transform.localScale = new Vector3(rect.width, rect.height, 0); } } ButtonGame.SetActive(true); IsNeedGame = false; BuyButtonlink.enabled = true; Descip.transform.localPosition = new Vector3(-167.8f, 36.98f, 100); if (MiniGameTableJeka2.IsMiniGameTechnology(shopItem.Id)) { idGame = MiniGameTableJeka2.GetMiniGameTechnology(shopItem.Id); if (GameControllerLevel2.Instance.ListResultGame[idGame.Id] == StatusEndGameEnum.Non) { BuyButtonlink.enabled = false; IsNeedGame = true; } else { BuyButtonlink.enabled = true; IsNeedGame = false; } } else { ButtonGame.SetActive(false); } } else { var shopItem = (MoodShopEntity)args[0]; if (shopItem == null) { return; } moodItem = shopItem; Caption.text = "";// shopItem.Name; Descip.transform.localPosition = new Vector3(0, 0, 100); Text.text = shopItem.Description; Sprite.spriteName = shopItem.Sprite; Price.text = "Купить за " + shopItem.Cost; var rect1 = Sprite.atlas.GetSprite(shopItem.Sprite); if (rect1 != null) { var rect = rect1.outer; Sprite.gameObject.transform.localScale = new Vector3(rect.width, rect.height, 1); } ButtonGame.SetActive(false); } }
void Instance_OnSceneLoaded(MiniGame minigame) { nextGameLoaded = true; currentMinigame = minigame; StartMinigameIfReady(); }