// Use this for initialization void Start() { // Find assocciated minigame minigame = GetComponent<Minigame>(); tutorialHand = GameObject.Find ("TutorialHand"); tutorialHand.SetActive(false); currLevel = 0; foreach(DifficultySession ds in difficultySessions) { if(ds.difficulty == minigame.difficulty) { currentDifficultySession = ds; break; } } setupGame(); if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode { Destroy(tutorialOptions); if(!showTutorial) { setupLevel(); disableAllKeys(); } // Show the instructions of the minigame if (minigame != null && minigame.StartConversation() == false) { Debug.Log("S: Let's get this lock open!"); } Invoke("continueDialogue", minigame.GetCurrentDialogueDuration()); } if (minigame.minigameEndEvent != null) minigame.minigameEndEvent.location = null; }
// Use this for initialization void Start() { Random.seed = (int) (System.DateTime.UtcNow.Ticks % int.MaxValue); // Find assocciated minigame minigame = GetComponent<Minigame>(); Sherlock.Instance.SetBubblePosition(Sherlock.side.DOWN); interestOptionsRoot.SetActive(false); hiddenObjectsRoot.SetActive(false); tutorialHand = GameObject.Find ("TutorialHand").GetComponent<TutorialHand>(); currentLevel = -1; ShuffleCharacters(); ResetDisplayObjects(); Sherlock.Instance.HideDialogue(); if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode { Destroy(tutorialOptions); if(showTutorial) { // Show the instructions of the minigame if (minigame != null && minigame.StartConversation() == false) { Debug.Log("To learn other peoples’ interests, use your eyes to find clues about them."); } StartCoroutine("startTutorial"); } else { // Show the instructions of the minigame if (minigame != null && minigame.StartConversation() == false) { Debug.Log("To learn other peoples’ interests, use your eyes to find clues about them."); } Invoke ("InitializeFirstLevel", minigame.GetCurrentDialogueDuration()); } } }
// Use this for initialization void Start() { // Find assocciated minigame minigame = GetComponent<Minigame>(); MinigameDifficulty.Difficulty difficulty = minigame.difficulty; // Initialize levels array myLevels = new GameObject[numLevels]; // Easy or medium assets if(minigame.difficulty != MinigameDifficulty.Difficulty.HARD) { foodsAtlas = (UIAtlas) Resources.Load ("NPCs/Amy/AmyLargeFoodBuffetAtlas", typeof(UIAtlas)); // Gets all large foods foreach(string s in foodsAtlas.GetListOfSprites()) { if(s.Contains("dess")) { dessertItems.Add (s); } else if(s.Contains("app")) { appetizerItems.Add (s); } else if(s.Contains("main")) { mainItems.Add (s); } } // Randomizes the possible appetizer foods for(int appRandomizer = 0; appRandomizer < appetizerItems.Count; appRandomizer++) { int randomindex = Random.Range(appRandomizer, appetizerItems.Count - 1); string swap = (string)appetizerItems[randomindex]; appetizerItems[randomindex] = appetizerItems[appRandomizer]; appetizerItems[appRandomizer] = swap; } // Randomizes the possible main foods for(int mainRandomizer = 0; mainRandomizer < mainItems.Count; mainRandomizer++) { int randomindex = Random.Range(mainRandomizer, mainItems.Count - 1); string swap = (string)mainItems[randomindex]; mainItems[randomindex] = mainItems[mainRandomizer]; mainItems[mainRandomizer] = swap; } // Randomizes the possible dessert foods for(int dessertRandomizer = 0; dessertRandomizer < dessertItems.Count; dessertRandomizer++) { int randomindex = Random.Range(dessertRandomizer, dessertItems.Count - 1); string swap = (string)dessertItems[randomindex]; dessertItems[randomindex] = dessertItems[dessertRandomizer]; dessertItems[dessertRandomizer] = swap; } } // Hard assets if(minigame.difficulty == MinigameDifficulty.Difficulty.HARD) { foodsAtlas = (UIAtlas) Resources.Load ("NPCs/Amy/AmySmallFoodBuffetAtlas", typeof(UIAtlas)); // Gets all large foods foreach(string s in foodsAtlas.GetListOfSprites()) { if(s.Contains("dess")) { dessertItems.Add (s); } else if(s.Contains("app")) { appetizerItems.Add (s); } else if(s.Contains("main")) { mainItems.Add (s); } } // Randomizes the possible appetizer foods for(int appRandomizer = 0; appRandomizer < appetizerItems.Count; appRandomizer++) { int randomindex = Random.Range(appRandomizer, appetizerItems.Count - 1); string swap = (string)appetizerItems[randomindex]; appetizerItems[randomindex] = appetizerItems[appRandomizer]; appetizerItems[appRandomizer] = swap; } // Randomizes the possible main foods for(int mainRandomizer = 0; mainRandomizer < mainItems.Count; mainRandomizer++) { int randomindex = Random.Range(mainRandomizer, mainItems.Count - 1); string swap = (string)mainItems[randomindex]; mainItems[randomindex] = mainItems[mainRandomizer]; mainItems[mainRandomizer] = swap; } // Randomizes the possible dessert foods for(int dessertRandomizer = 0; dessertRandomizer < dessertItems.Count; dessertRandomizer++) { int randomindex = Random.Range(dessertRandomizer, dessertItems.Count - 1); string swap = (string)dessertItems[randomindex]; dessertItems[randomindex] = dessertItems[dessertRandomizer]; dessertItems[dessertRandomizer] = swap; } } // Get all the foods in the target trays ArrayList targetFoodsSmall = new ArrayList(); foreach(Transform targetFood in smallTargetTray.transform) { if(!targetFood.gameObject.name.Contains("Tray")) { targetFoodsSmall.Add (targetFood.gameObject); } } ArrayList targetFoodsLarge = new ArrayList(); foreach(Transform targetFood in largeTargetTray.transform) { if(!targetFood.gameObject.name.Contains("Tray")) { targetFoodsLarge.Add (targetFood.gameObject); } } // Remove two plates from the target trays for(int randomInt = 0; randomInt < 2; randomInt++) { int randomIndex = Random.Range(0, targetFoodsSmall.Count - 1); GameObject targetFoodToRemove = ((GameObject)targetFoodsSmall[randomIndex]).gameObject; targetFoodToRemove.SetActive(false); targetFoodsSmall.Remove(targetFoodToRemove); GameObject targetFoodToRemoveLarge = largeTargetTray.transform.FindChild(targetFoodToRemove.name).gameObject; targetFoodToRemoveLarge.SetActive(false); targetFoodsLarge.Remove(targetFoodToRemoveLarge); } // Get dropspots from player tray GameObject[] dropspots = new GameObject[5]; for(int dropspotsCounterOne = 0; dropspotsCounterOne < 5; dropspotsCounterOne++) dropspots[dropspotsCounterOne] = playerTray.transform.FindChild("Slot" + (dropspotsCounterOne + 1).ToString()).gameObject; // Get all levels in the scene int i = 0; moveDistace.x = buffetTexture.transform.localScale.x; while(i < myLevels.Length) { Transform t = buffet.transform.FindChild("BuffetLevel" + i.ToString()); if (t != null) { myLevels[i] = t.gameObject; // Get all food items in the current level ArrayList foods = new ArrayList(); // Easy difficulty, 4 items if(difficulty == MinigameDifficulty.Difficulty.EASY) { for(int easyCounter = 0; easyCounter < 4; easyCounter++) { GameObject newFood = (GameObject) Instantiate(buffetItem); newFood.transform.parent = myLevels[i].transform; newFood.transform.localPosition = new Vector3(-250 + easyCounter * 90, 290 - easyCounter % 2 * 200, 10); newFood.transform.localScale = new Vector3(2, 2, 2); newFood.transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false); newFood.transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false); GameObject newFoodItem = newFood.transform.FindChild("Buffet_ItemEasy").gameObject; newFoodItem.GetComponent<UISprite>().atlas = foodsAtlas; for(int dropspotsCounter = 0; dropspotsCounter < 5; dropspotsCounter++) newFood.GetComponent<DraggableObjectBuffet>().dropspots[dropspotsCounter] = dropspots[dropspotsCounter]; switch(i) { case 0: newFoodItem.GetComponent<UISprite>().spriteName = (string)appetizerItems[easyCounter]; break; case 1: newFoodItem.GetComponent<UISprite>().spriteName = (string)mainItems[easyCounter]; break; case 2: newFoodItem.GetComponent<UISprite>().spriteName = (string)dessertItems[easyCounter]; break; default: newFood.GetComponent<UISprite>().spriteName = (string)appetizerItems[easyCounter]; break; } foods.Add(newFood); } } // Medium difficulty, 8 items if(difficulty == MinigameDifficulty.Difficulty.MEDIUM) { for(int mediumCounter = 0; mediumCounter < 8; mediumCounter++) { GameObject newFood = (GameObject) Instantiate(buffetItem); newFood.transform.parent = myLevels[i].transform; newFood.transform.localPosition = new Vector3(-370 + mediumCounter * 77 - (mediumCounter % 2)*30, 260 - mediumCounter % 2 * 180, 10); newFood.transform.localScale = new Vector3(2, 2, 2); newFood.transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false); newFood.transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false); GameObject newFoodItem = newFood.transform.FindChild("Buffet_ItemEasy").gameObject; newFoodItem.GetComponent<UISprite>().atlas = foodsAtlas; for(int dropspotsCounter = 0; dropspotsCounter < 5; dropspotsCounter++) newFood.GetComponent<DraggableObjectBuffet>().dropspots[dropspotsCounter] = dropspots[dropspotsCounter]; switch(i) { case 0: newFoodItem.GetComponent<UISprite>().spriteName = (string)appetizerItems[mediumCounter]; break; case 1: newFoodItem.GetComponent<UISprite>().spriteName = (string)mainItems[mediumCounter]; break; case 2: newFoodItem.GetComponent<UISprite>().spriteName = (string)dessertItems[mediumCounter]; break; default: newFood.GetComponent<UISprite>().spriteName = (string)appetizerItems[mediumCounter]; break; } foods.Add(newFood); } } // Hard difficulty, 8 items split if(difficulty == MinigameDifficulty.Difficulty.HARD) { for(int hardCounter = 0; hardCounter < 8; hardCounter++) { GameObject newFood = (GameObject) Instantiate(buffetItem); newFood.transform.parent = myLevels[i].transform; newFood.transform.localPosition = new Vector3(-370 + hardCounter * 77 - (hardCounter % 2)*30, 260 - hardCounter % 2 * 180, 10); newFood.transform.localScale = new Vector3(2, 2, 2); newFood.transform.localEulerAngles = new Vector3(0, 0, 30); newFood.transform.FindChild("Buffet_ItemEasy").gameObject.SetActive(false); GameObject newFoodItem1 = newFood.transform.FindChild("Buffet_ItemHard1").gameObject; newFoodItem1.GetComponent<UISprite>().atlas = foodsAtlas; GameObject newFoodItem2 = newFood.transform.FindChild("Buffet_ItemHard2").gameObject; newFoodItem2.GetComponent<UISprite>().atlas = foodsAtlas; for(int dropspotsCounter = 0; dropspotsCounter < 5; dropspotsCounter++) newFood.GetComponent<DraggableObjectBuffet>().dropspots[dropspotsCounter] = dropspots[dropspotsCounter]; int nextHardCounter = hardCounter + 1; if(nextHardCounter >= 8) nextHardCounter = 0; switch(i) { case 0: newFoodItem1.GetComponent<UISprite>().spriteName = (string)appetizerItems[hardCounter]; newFoodItem2.GetComponent<UISprite>().spriteName = (string)appetizerItems[nextHardCounter]; break; case 1: newFoodItem1.GetComponent<UISprite>().spriteName = (string)mainItems[hardCounter]; newFoodItem2.GetComponent<UISprite>().spriteName = (string)mainItems[nextHardCounter]; break; case 2: newFoodItem1.GetComponent<UISprite>().spriteName = (string)dessertItems[hardCounter]; newFoodItem2.GetComponent<UISprite>().spriteName = (string)dessertItems[nextHardCounter]; break; default: newFood.GetComponent<UISprite>().spriteName = (string)appetizerItems[hardCounter]; newFoodItem2.GetComponent<UISprite>().spriteName = (string)appetizerItems[nextHardCounter]; break; } foods.Add(newFood); } } // Randomize the order of items in the buffet for(int foodsCounter = 0; foodsCounter < foods.Count; foodsCounter++) { int randomindex = Random.Range(foodsCounter, foods.Count - 1); // Swap positions float x = ((GameObject)foods[randomindex]).transform.position.x; float y = ((GameObject)foods[randomindex]).transform.position.y; ((GameObject)foods[randomindex]).transform.position = new Vector3( ((GameObject)foods[foodsCounter]).transform.position.x, ((GameObject)foods[foodsCounter]).transform.position.y, ((GameObject)foods[foodsCounter]).transform.position.z); ((GameObject)foods[foodsCounter]).transform.position = new Vector3(x, y, ((GameObject)foods[foodsCounter]).transform.position.z); } // Make one item the target food GameObject correctFood = (GameObject)foods[Random.Range(0, foods.Count - 1)]; GameObject correctFoodEasy = correctFood.transform.FindChild("Buffet_ItemEasy").gameObject; GameObject correctFoodHard1 = correctFood.transform.FindChild("Buffet_ItemHard1").gameObject; GameObject correctFoodHard2 = correctFood.transform.FindChild("Buffet_ItemHard2").gameObject; // Update the small and large food tray's plate for easy and medium if(difficulty != MinigameDifficulty.Difficulty.HARD) { ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false); ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false); ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemEasy").gameObject.GetComponent<UISprite>().atlas = foodsAtlas; ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemEasy").gameObject.GetComponent<UISprite>().spriteName = correctFoodEasy.GetComponent<UISprite>().spriteName; // Find and update the large food tray's plate foreach(GameObject g in targetFoodsLarge) { if(g.name == ((GameObject)targetFoodsSmall[i]).gameObject.name) { g.transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false); g.transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false); g.transform.FindChild("Buffet_ItemEasy").gameObject.GetComponent<UISprite>().atlas = foodsAtlas; g.transform.FindChild("Buffet_ItemEasy").GetComponent<UISprite>().spriteName = correctFoodEasy.GetComponent<UISprite>().spriteName; break; } } } else if(difficulty == MinigameDifficulty.Difficulty.HARD) { ((GameObject)targetFoodsSmall[i]).transform.localEulerAngles = new Vector3(0, 0, 30); ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemEasy").gameObject.SetActive(false); ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard1").gameObject.GetComponent<UISprite>().atlas = foodsAtlas; ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard1").gameObject.GetComponent<UISprite>().spriteName = correctFoodHard1.GetComponent<UISprite>().spriteName; ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard2").gameObject.GetComponent<UISprite>().atlas = foodsAtlas; ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard2").gameObject.GetComponent<UISprite>().spriteName = correctFoodHard2.GetComponent<UISprite>().spriteName; // Find and update the large food tray's plate foreach(GameObject g in targetFoodsLarge) { if(g.name == ((GameObject)targetFoodsSmall[i]).gameObject.name) { g.transform.localEulerAngles = new Vector3(0, 0, 30); g.transform.FindChild("Buffet_ItemEasy").gameObject.SetActive(false); g.transform.FindChild("Buffet_ItemHard1").GetComponent<UISprite>().atlas = foodsAtlas; g.transform.FindChild("Buffet_ItemHard1").GetComponent<UISprite>().spriteName = correctFoodHard1.GetComponent<UISprite>().spriteName; g.transform.FindChild("Buffet_ItemHard2").GetComponent<UISprite>().atlas = foodsAtlas; g.transform.FindChild("Buffet_ItemHard2").GetComponent<UISprite>().spriteName = correctFoodHard2.GetComponent<UISprite>().spriteName; break; } } } correctFood.GetComponent<DraggableObjectBuffet>().isSolution = true; correctFood.GetComponent<DraggableObjectBuffet>().correctSlot = ((GameObject)targetFoodsSmall[i]).name.Replace("Spot", ""); myLevels[i].transform.localPosition = moveDistace * i; } else break; i++; } // Find all game objects related the minigame largeSample = GameObject.Find("SampleTrayLarge"); smallSample = GameObject.Find("SampleTraySmall"); smallSample.SetActive(false); smallSampleBubble = GameObject.Find("SampleTrayBubble"); smallSampleBubble.SetActive(false); myTray = GameObject.Find ("PlayerTray"); myTray.SetActive(false); endGame = GameObject.Find ("EndBackground"); endGame.SetActive(false); buffet.SetActive(false); tutorialHand = GameObject.Find("TutorialHand"); tutorialHand.SetActive(false); tutorialBuffet = GameObject.Find ("TutorialBuffet"); tutorialObject = GameObject.Find ("TutorialObject"); tutorialBuffet.SetActive(false); tutorialObject.SetActive(false); if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode { Destroy(tutorialOptions); if(showTutorial) { largeSample.SetActive(false); myTray.SetActive(true); tutorialBuffet.SetActive(true); StartCoroutine("startTutorial"); } else { // Show the instructions of the minigame if (minigame != null && minigame.StartConversation() == false) { Debug.Log("S: This is Amy's original order. She had a garden salad, burger and strawberries. We must remake Amy's lunch exactly as it appears, so choose the RIGHT item, and place it in the RIGHT location."); } Invoke ("LayBuffet", minigame.GetCurrentDialogueDuration()); } } }
// Use this for initialization void Start() { phase = 0; //Debug.Log("Phase: " + phase); notepad.SetActive(false); cont = true; myLevels = new GameObject[numLevels]; myAnswers = new GameObject[numLevels]; //find first level, or MaxLevel0 //myLevels[0] = GameObject.Find("MaxLevel0"); //fill up myLevels with remaining //int i = 1; for (int i = 0 ; i < numLevels ; i++)//(GameObject.Find("MaxLevel" + i.ToString()) !=null) { myLevels[i] = GameObject.Find("MaxLevel" + i.ToString()); foreach(Transform child in myLevels[i].transform) { child.gameObject.SetActive(false); } myAnswers[i] = GameObject.Find("Answer" + i.ToString()); myAnswers[i].SetActive(false); } for(int i = 0; i<3; i++) { crosses[i].SetActive(false); } // Find assocciated minigame minigame = GetComponent<Minigame>(); tutorialHand = GameObject.Find ("TutorialHand"); tutorialHand.SetActive(false); tutorialObject = GameObject.Find("TutorialObject"); tutorialObject.SetActive(false); notepad.SetActive(true); checkmark.SetActive(false); phase = 1; currLevel = 0; PlayAnimation (NPCAnimations.AnimationIndex.NEUTRAL); if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode { Destroy(tutorialOptions); // Show the instructions of the minigame if (minigame != null && minigame.StartConversation() == false) { Debug.Log("S: Let's help Max make new choices based on what he already likes. Max will give you a description for each category, you choose something similar."); } Invoke("continueDialogue", minigame.GetCurrentDialogueDuration()); //StartCoroutine(WaitForInput("startGame")); //Invoke ("startGame", minigame.conversationTree.root.GetCommulativeDuration() + 1.5f); } }
void Start() { Instance = this; //changing these to the background sprite to attempt to access their color directly, if it doesn't work, //change it back to "MoveRightHandButton" etc. userButtons [(int)eType.RIGHT] = new PlayerSprite ("MoveRightHandButton"); userButtons [(int)eType.LEFT] = new PlayerSprite ("MoveLeftHandButton"); userButtons [(int)eType.CLAP] = new PlayerSprite ("MoveClapHandButton"); UpdatePlayerTextures(); tutorialHand = GameObject.Find("TutorialHand"); tutorialHand.SetActive(false); Sherlock.Instance.SetBubblePosition (Sherlock.side.DOWN); // Find assocciated minigame minigame = GetComponent<Minigame> (); Sherlock.Instance.HideDialogue(); if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode { Destroy(tutorialOptions); showTutorial = true; // Show the instructions of the minigame if (minigame != null && minigame.StartConversation () == false) { Debug.Log (minigame.conversationTree.root); } Invoke("continueDialogue", minigame.GetCurrentDialogueDuration()); leftLabelOffset = instructionLabelOffset; rightLabelOffset = instructionLabelOffset; rightLabelOffset.x = -rightLabelOffset.x; SetHandColliders(false); } //noTutorial(); }