public void playSoundClip() { if ((ickyStates == NF_IckyAnimationStates.icky_eating) || (ickyStates == NF_IckyAnimationStates.icky_angleJumpNEat)) { listOfClips = new List <AudioClip>(); listOfClips.Add(voiceOversIcky[(int)ickySounds.s_yummy]); NF_SoundManager.playAudioList(listOfClips); NF_SoundManager.playSFX(voiceOversIcky[(int)ickySounds.s_eating]); } else if (ickyStates == NF_IckyAnimationStates.icky_wrongAns) { int randomIndex = Random.Range(8, 13); if (randomIndex == 12) { NF_QuestionLoader questionLoader = GameObject.Find("Question").GetComponent <NF_QuestionLoader>(); listOfClips = new List <AudioClip>(); listOfClips.Add(voiceOversIcky[randomIndex]); listOfClips.Add(questionLoader.hangingObject_VO(questionLoader.selectedTitle)); NF_SoundManager.playAudioList(listOfClips); } else { listOfClips = new List <AudioClip>(); listOfClips.Add(voiceOversIcky[randomIndex]); } NF_SoundManager.playAudioList(listOfClips); } else if (ickyStates == NF_IckyAnimationStates.icky_celebration) { listOfClips = new List <AudioClip>(); listOfClips.Add(voiceOversIcky[7]); NF_SoundManager.playAudioList(listOfClips); NF_SoundManager.playSFX(voiceOversIcky[13]); } else if (ickyStates == NF_IckyAnimationStates.icky_giggle) { int s = UnityEngine.Random.Range(3, 6); listOfClips = new List <AudioClip>(); listOfClips.Add(voiceOversIcky[s]); NF_SoundManager.playAudioList(listOfClips); } }
void ickyCorrentAnswer(GameObject destroyedFood) { isTouchesEnable_2 = false; // create rope cut animation here GameObject ropeCutDown = Instantiate(ropeCutDownPrefab) as GameObject; ropeCutDown.name = "fruit_RopeCutDown"; ropeCutDown.transform.parent = destroyedFood.transform; destroyedFood.transform.position = new Vector3(destroyedFood.transform.position.x, destroyedFood.transform.position.y, 300); ropeCutDown.transform.position = new Vector3(destroyedFood.transform.position.x, destroyedFood.transform.position.y + 70, destroyedFood.transform.position.z - 5); randomJumpIndex = Random.Range(0, 3); if (randomJumpIndex == 0) { iTween.MoveTo(destroyedFood, iTween.Hash("position", new Vector3(destroyedFood.transform.position.x, -240, 300.0f), "time", 18.0f / 50.0f + 9.0f / 30.0f, "onComplete", "createParticles", "oncompletetarget", gameObject, "oncompleteparams", destroyedFood, "easetype", iTween.EaseType.linear)); ickyAnim.playEatingAnimation(destroyedFood.transform.position.x, NF_IckyAnimationStates.icky_jumping); } else if (randomJumpIndex == 1) { iTween.MoveTo(destroyedFood, iTween.Hash("position", new Vector3(destroyedFood.transform.position.x, -240 + 177.5f, 300.0f), "time", 21.0f / 50.0f, "onComplete", "createParticles", "oncompletetarget", gameObject, "oncompleteparams", destroyedFood, "easetype", iTween.EaseType.linear)); ickyAnim.playEatingAnimation(destroyedFood.transform.position.x, NF_IckyAnimationStates.icky_angleJumpNEat); } else if (randomJumpIndex == 2) { iTween.MoveTo(destroyedFood, iTween.Hash("position", new Vector3(destroyedFood.transform.position.x, -180, 300.0f), "time", 27.0f / 50.0f, "onComplete", "bounceFruitOnIcky", "oncompletetarget", gameObject, "oncompleteparams", destroyedFood, "easetype", iTween.EaseType.linear)); ickyAnim.ickyStates = NF_IckyAnimationStates.icky_bounceNEat; ickyAnim.setIckyPosition_HopAnimation(destroyedFood.transform.position.x, NF_IckyAnimationStates.icky_bounceNEat); } // fade out bubble NF_QuestionLoader questionLoader = GameObject.Find("Question").GetComponent <NF_QuestionLoader>(); questionLoader.fadeOutAllObjects(); }
void getAllComponentsRef() { GameObject question = GameObject.Find("Question"); questionLoader = (NF_QuestionLoader)question.GetComponent <NF_QuestionLoader>(); GameObject trail = GameObject.Find("Drag_Trail"); dragTrail = (NF_DragTrail)trail.GetComponent <NF_DragTrail>(); ropesGenerator = (NF_RopesGenerator)this.GetComponent <NF_RopesGenerator>(); inputController = (NF_InputController)this.GetComponent <NF_InputController>(); // select skill id On random if (AGGameState.currentGameIndex == (int)AGGameIndex.k_NamingFruits) { currentCategoryID = (int)Random.Range((int)NamingFruits_CategoryID.id_Food, (int)NamingFruits_CategoryID.id_AlplabeticOrder + 1); backgroundsCount = 4; backgroundArray = new string[] { "Green", "Orange", "Blue", "Sunrise" }; foregroundArray = new string[] { "Top-Green-Back", "Top-Orange-Back", "Top-Blue-Back", "Top-Sunrise-Back" }; frontLayerArray = new string[] { "Top-Green-Front", "Top-Orange-Front", "Top-Blue-Front", "Top-Sunrise-Front" }; dataManager = new JW_DataManager(AGGameIndex.k_NamingFruits, currentCategoryID, _progressionList.text); dataManager.loadCategoryResources(_resourcesData.text); dataManager.currentLevel = 1; dataManager.fetchLevelData(); } else if (AGGameState.currentGameIndex == (int)AGGameIndex.k_2DShapesColors) { currentCategoryID = (int)Random.Range((int)SimpleColors_CategoryID.id_Colors, (int)SimpleColors_CategoryID.id_2DShapes + 1); backgroundsCount = 2; backgroundArray = new string[] { "Pink", "Purple" }; foregroundArray = new string[] { "Pink-Back-Frill", "Purple-Back-Frill" }; frontLayerArray = new string[] { "Pink-Front-Frill", "Purple-Front-Frill" }; dataManager = new JW_DataManager(AGGameIndex.k_2DShapesColors, currentCategoryID, _progressionList.text); dataManager.loadCategoryResources(_resourcesData.text); dataManager.currentLevel = 1; dataManager.fetchLevelData(); } Debug.Log("NF_Skill ID:" + currentCategoryID); }
public void playIcky_Animations() { NF_InputController IC = (NF_InputController)Camera.mainCamera.GetComponentInChildren <NF_InputController>(); if (ickyStates == NF_IckyAnimationStates.unknown || ickyStates == NF_IckyAnimationStates.icky_reseting) { IC.enableTouches(); renderer.material.mainTexture = ickyImage; transform.localScale = new Vector3(140, 165, 1); colCount = 1; rowCount = 1; colNumber = 0; rowNumber = 0; totalCells = 1; fps = 30; setCurrentFrame(0); } else if (ickyStates == NF_IckyAnimationStates.icky_weeping) { IC.disableTouches(); renderer.material.mainTexture = weepingSheet; transform.localScale = new Vector3(166, 126, 1); colCount = 2; rowCount = 1; colNumber = 0; rowNumber = 0; totalCells = 2; fps = 30; if (weepingFrames == null || weepingFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)weepingFrames[0]); weepingFrames.RemoveAt(0); if (weepingFrames.Count == 0) { ickyStates = NF_IckyAnimationStates.unknown; createAnimations(); callLoadNextQuestion(); } } else if (ickyStates == NF_IckyAnimationStates.icky_weeping2) { IC.disableTouches(); renderer.material.mainTexture = weepingSheet; transform.localScale = new Vector3(166, 126, 1); colCount = 2; rowCount = 1; colNumber = 0; rowNumber = 0; totalCells = 2; fps = 30; if (weepingFrames == null || weepingFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)weepingFrames[0]); weepingFrames.RemoveAt(0); if (weepingFrames.Count == 0) { currentFrame = 0; fps = 30; ickyStates = NF_IckyAnimationStates.unknown; createAnimations(); callLoadNextQuestion(); } } else if (ickyStates == NF_IckyAnimationStates.icky_giggle) { IC.disableTouches(); renderer.material.mainTexture = giggleSheet; transform.localScale = new Vector3(135, 148, 1); colCount = 8; rowCount = 3; colNumber = 0; rowNumber = 0; totalCells = 23; fps = 30; if (giggleFrames == null || giggleFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)giggleFrames[0]); giggleFrames.RemoveAt(0); if (giggleFrames.Count == 0) { currentFrame = 0; fps = 30; ickyStates = NF_IckyAnimationStates.icky_idle; createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_celebration) { IC.disableTouches(); renderer.material.mainTexture = celebrationSheet; transform.localScale = new Vector3(200, 175, 1); colCount = 8; rowCount = 7; colNumber = 0; rowNumber = 0; totalCells = 53; fps = 30; if (celebrationFrames == null || celebrationFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)celebrationFrames[0]); celebrationFrames.RemoveAt(0); if (celebrationFrames.Count == 0) { fps = 30; currentFrame = 0; ickyStates = NF_IckyAnimationStates.icky_idle; createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_want) { IC.enableTouches(); renderer.material.mainTexture = wantSheet; transform.localScale = new Vector3(145, 160, 1); colCount = 5; rowCount = 5; colNumber = 0; rowNumber = 0; totalCells = 25; fps = 30; if (wantFrames == null || wantFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)wantFrames[0]); wantFrames.RemoveAt(0); if (wantFrames.Count == 0) { currentFrame = 0; fps = 30; ickyStates = NF_IckyAnimationStates.icky_idle; createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_idle) { IC.enableTouches(); renderer.material.mainTexture = idleSheet; transform.localScale = new Vector3(140, 165, 1); colCount = 10; rowCount = 6; colNumber = 0; rowNumber = 0; totalCells = 59; fps = 30; if (idleFrames == null || idleFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)idleFrames[0]); idleFrames.RemoveAt(0); if (idleFrames.Count == 0) { currentFrame = 0; fps = 30; ickyStates = NF_IckyAnimationStates.icky_want; createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_eating) { IC.disableTouches(); renderer.material.mainTexture = eating1Sheet; transform.localScale = new Vector3(150, 158, 1); colCount = 8; rowCount = 7; colNumber = 0; rowNumber = 0; totalCells = 53; fps = 50; if (eating1Frames == null || eating1Frames.Count == 0) { createAnimations(); } setCurrentFrame((int)eating1Frames[0]); eating1Frames.RemoveAt(0); if (eating1Frames.Count == 0) { if (IC._totalAnswersCount > 0) { setIckyPosition_HopAnimation(0.0f, NF_IckyAnimationStates.icky_hop); } else { if (shouldPlayCelebration) { shouldPlayCelebration = false; ickyStates = NF_IckyAnimationStates.icky_celebration; playSoundClip(); } else { ickyStates = NF_IckyAnimationStates.icky_idle; } fps = 30; currentFrame = 0; createAnimations(); } } } else if (ickyStates == NF_IckyAnimationStates.icky_wrongAns) { renderer.material.mainTexture = wrongSheet; transform.localScale = new Vector3(115, 145, 1); colCount = 8; rowCount = 2; colNumber = 0; rowNumber = 0; totalCells = 24; fps = 30; if (wrongFrames == null || wrongFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)wrongFrames[0]); wrongFrames.RemoveAt(0); if (wrongFrames.Count == 0) { IC.disableTouches(); fps = 30; currentFrame = 0; ickyStates = NF_IckyAnimationStates.icky_idle; createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_jumping) { IC.disableTouches(); renderer.material.mainTexture = jump1Sheet; if (shouldFlipHop) { transform.localScale = new Vector3(-180, 250, 1); } else { transform.localScale = new Vector3(180, 250, 1); } colCount = 6; rowCount = 3; colNumber = 0; rowNumber = 0; totalCells = 18; fps = 50; if (jump1Frames == null || jump1Frames.Count == 0) { createAnimations(); } setCurrentFrame((int)jump1Frames[0]); jump1Frames.RemoveAt(0); if (jump1Frames.Count == 0) { fps = 30; currentFrame = 0; ickyStates = NF_IckyAnimationStates.icky_eating; playSoundClip(); createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_bouncing) { IC.disableTouches(); renderer.material.mainTexture = bouncingSheet; if (shouldFlipHop) { transform.localScale = new Vector3(-125, 165, 1); } else { transform.localScale = new Vector3(125, 165, 1); } colCount = 6; rowCount = 4; colNumber = 0; rowNumber = 0; totalCells = 22; fps = 50; if (jump1Frames == null || jump1Frames.Count == 0) { createAnimations(); } setCurrentFrame((int)jump1Frames[0]); jump1Frames.RemoveAt(0); if (jump1Frames.Count == 0) { fps = 30; currentFrame = 0; ickyStates = NF_IckyAnimationStates.icky_eating; playSoundClip(); createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_angleJumpNEat) { IC.disableTouches(); renderer.material.mainTexture = angleJumpNEatSheet; if (shouldFlipHop) { transform.localScale = new Vector3(-165, 355, 1); } else { transform.localScale = new Vector3(165, 335, 1); } colCount = 9; rowCount = 6; colNumber = 0; rowNumber = 0; totalCells = 51; fps = 50; if (angleJumpFrames == null || angleJumpFrames.Count == 0) { createAnimations(); } setCurrentFrame((int)angleJumpFrames[0]); angleJumpFrames.RemoveAt(0); if (angleJumpFrames.Count == 0) { Vector3 newPos = this.transform.position; newPos.y = newPos.y - 95; this.transform.position = newPos; transform.localScale = new Vector3(140, 165, 1); NF_QuestionLoader questionLoader1 = GameObject.Find("Question").GetComponent <NF_QuestionLoader>(); questionLoader1.moveToIckyPosition(); NF_GameController gameController = (NF_GameController)Camera.mainCamera.GetComponentInChildren <NF_GameController>(); gameController.thoughtBubbleFadeIn(); fps = 30; currentFrame = 0; if (shouldPlayCelebration) { shouldPlayCelebration = false; ickyStates = NF_IckyAnimationStates.icky_celebration; playSoundClip(); } else { ickyStates = NF_IckyAnimationStates.icky_idle; } createAnimations(); } } else if (ickyStates == NF_IckyAnimationStates.icky_hop || ickyStates == NF_IckyAnimationStates.icky_bounceNEat) { IC.disableTouches(); renderer.material.mainTexture = jump1Sheet; if (shouldFlipHop) { transform.localScale = new Vector3(-180, 250, 1); } else { transform.localScale = new Vector3(180, 250, 1); } colCount = 6; rowCount = 3; colNumber = 0; rowNumber = 0; totalCells = 18; fps = 50; if (jump1Frames == null || jump1Frames.Count == 0) { createAnimations(); } setCurrentFrame((int)jump1Frames[0]); jump1Frames.RemoveAt(0); if (jump1Frames.Count == 0) { if (ickyStates == NF_IckyAnimationStates.icky_hop) { NF_QuestionLoader questionLoader1 = GameObject.Find("Question").GetComponent <NF_QuestionLoader>(); questionLoader1.moveToIckyPosition(); NF_GameController gameController = (NF_GameController)Camera.mainCamera.GetComponentInChildren <NF_GameController>(); gameController.thoughtBubbleFadeIn(); fps = 30; currentFrame = 0; ickyStates = NF_IckyAnimationStates.icky_idle; createAnimations(); } else { fps = 30; currentFrame = 0; ickyStates = NF_IckyAnimationStates.icky_bouncing; NF_SoundManager.playSFX(voiceOversIcky[14]); playSoundClip(); createAnimations(); } } } }
void playInstructionalVO() { NF_QuestionLoader ql = GameObject.Find("Question").GetComponent <NF_QuestionLoader>(); ql.playQuestionVO(); }
void getAllComponentsRef() { GameObject question = GameObject.Find("Question"); questionLoader = (NF_QuestionLoader) question.GetComponent<NF_QuestionLoader>(); GameObject trail = GameObject.Find("Drag_Trail"); dragTrail = (NF_DragTrail) trail.GetComponent<NF_DragTrail>(); ropesGenerator = (NF_RopesGenerator) this.GetComponent<NF_RopesGenerator>(); inputController = (NF_InputController) this.GetComponent<NF_InputController>(); // select skill id On random if(AGGameState.currentGameIndex == (int) AGGameIndex.k_NamingFruits){ currentCategoryID=(int)Random.Range((int)NamingFruits_CategoryID.id_Food,(int)NamingFruits_CategoryID.id_AlplabeticOrder+1); backgroundsCount=4; backgroundArray = new string[] {"Green","Orange","Blue","Sunrise"}; foregroundArray = new string[] {"Top-Green-Back","Top-Orange-Back","Top-Blue-Back","Top-Sunrise-Back"}; frontLayerArray = new string[] {"Top-Green-Front","Top-Orange-Front","Top-Blue-Front","Top-Sunrise-Front"}; dataManager = new JW_DataManager(AGGameIndex.k_NamingFruits,currentCategoryID,_progressionList.text); dataManager.loadCategoryResources(_resourcesData.text); dataManager.currentLevel=1; dataManager.fetchLevelData(); } else if(AGGameState.currentGameIndex == (int) AGGameIndex.k_2DShapesColors){ currentCategoryID= (int)Random.Range((int)SimpleColors_CategoryID.id_Colors,(int)SimpleColors_CategoryID.id_2DShapes+1); backgroundsCount=2; backgroundArray = new string[] {"Pink","Purple"}; foregroundArray = new string[] {"Pink-Back-Frill","Purple-Back-Frill"}; frontLayerArray = new string[] {"Pink-Front-Frill","Purple-Front-Frill"}; dataManager = new JW_DataManager(AGGameIndex.k_2DShapesColors,currentCategoryID,_progressionList.text); dataManager.loadCategoryResources(_resourcesData.text); dataManager.currentLevel=1; dataManager.fetchLevelData(); } Debug.Log("NF_Skill ID:" + currentCategoryID); }