コード例 #1
0
    public void playQuestionVO()
    {
        AudioClip _instructionalVO = getInstructionalVO();
        AudioClip _nameOfClip      = hangingObject_VO(selectedTitle);

        if (currentGameMode == (int)GameModes.mode_different)
        {
            listOfClips = new List <AudioClip>();
            listOfClips.Add(_instructionalVO);
            NF_SoundManager.playAudioList(listOfClips);
        }
        else
        {
            listOfClips = new List <AudioClip>();
            listOfClips.Add(_instructionalVO);
            listOfClips.Add(_nameOfClip);
            if (AGGameState.currentGameIndex == (int)AGGameIndex.k_2DShapesColors && currentCategoryID == (int)SimpleColors_CategoryID.id_Colors)
            {
                if (answerCount > 1)
                {
                    listOfClips.Add(_balloonsVO);
                }
                else
                {
                    listOfClips.Add(_balloonVO);
                }
            }
            NF_SoundManager.playAudioList(listOfClips);
        }
    }
コード例 #2
0
    public IEnumerator playInitialVoiceOvers(AudioClip _instructionalVO, AudioClip _nameOfClip, float delay)
    {
        yield return(new WaitForSeconds(delay));

        if (currentGameMode == (int)GameModes.mode_different)
        {
            listOfClips = new List <AudioClip>();
            listOfClips.Add(_instructionalVO);
            NF_SoundManager.playAudioList(listOfClips);
        }
        else
        {
            listOfClips = new List <AudioClip>();
            listOfClips.Add(_instructionalVO);
            listOfClips.Add(_nameOfClip);
            if (AGGameState.currentGameIndex == (int)AGGameIndex.k_2DShapesColors && currentCategoryID == (int)SimpleColors_CategoryID.id_Colors)
            {
                if (answerCount > 1)
                {
                    listOfClips.Add(_balloonsVO);
                }
                else
                {
                    listOfClips.Add(_balloonVO);
                }
            }
            NF_SoundManager.playAudioList(listOfClips);
        }
    }
コード例 #3
0
    public static void playSFX(AudioClip _clip)
    {
        NF_SoundManager soundMng = (NF_SoundManager)Camera.mainCamera.GetComponentInChildren <NF_SoundManager>();

        if (soundMng.sfx_Source == null)
        {
            soundMng.sfx_Source = soundMng.AddAudio(null, false, false, 1.0f);
        }
        soundMng.sfx_Source.PlayOneShot(_clip);
    }
コード例 #4
0
    void intro_HopAnimation_3(float xPos)
    {
        NF_SoundManager.playSFX(voiceOversIcky[14]);
        ickyStates = NF_IckyAnimationStates.icky_hop;
        createAnimations();
        Vector3 pos = transform.position;

        pos.x        = xPos;
        currentFrame = 0;
        iTween.MoveTo(gameObject, iTween.Hash("position", pos,
                                              "time", 18.0f / 50.0f, "onComplete", "switchToIdle", "oncompletetarget", gameObject, "easetype", iTween.EaseType.linear));
    }
コード例 #5
0
    public static void playAudioList(List <AudioClip> clips)
    {
        NF_SoundManager soundMng = (NF_SoundManager)Camera.mainCamera.GetComponentInChildren <NF_SoundManager>();

        if (soundMng.a_Source == null)
        {
            soundMng.a_Source = soundMng.AddAudio(null, false, false, 1.0f);
        }
        if (clips != null && clips.Count > 0)
        {
            soundMng.a_Source.Stop();
            soundMng.currentClips = clips;
        }
    }
コード例 #6
0
 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);
     }
 }
コード例 #7
0
    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();
                }
            }
        }
    }
コード例 #8
0
 void switchToIdle()
 {
     NF_SoundManager.playSFX(voiceOversIcky[14]);
     ickyStates = NF_IckyAnimationStates.icky_idle;
 }
コード例 #9
0
 public void startingSFX()
 {
     NF_SoundManager.playSFX(instructionalVO[(int)Instructional_VO.k_bubblePop]);
     playQuestionVO();
 }
コード例 #10
0
    void checkHitOnObject(Vector2 fingerPos)
    {
        RaycastHit hit;
        Ray        ray;

        ray = Camera.main.ScreenPointToRay(fingerPos);
        if (Physics.Raycast(ray, out hit, 10000))
        {
            if (hit.collider.tag == "tag_Fruits")
            {
                if (fruitObj != hit.collider.transform.gameObject)
                {
                    fruitObj = hit.collider.transform.gameObject;
                    qAttempts++;
                }
                if (hit.collider.name == questionTitle)
                {
                    NF_SoundManager.playSFX(ropeCutSFx);
                    isWrongAnswer = false;
                    selectedFruit = hit.transform.gameObject;
                    createTickSign();
                    StartCoroutine(destroyCreatedObject(qTickObj, 0.2f));

                    Transform rope = selectedFruit.transform.parent;
                    breakJoints = rope.GetComponent <NF_BreakRopeJoints>();
                    GameObject destroyedFood = Instantiate(EmptyFruit) as GameObject;
                    destroyedFood.transform.localScale          = breakJoints._hangingObject.transform.localScale;
                    destroyedFood.renderer.material.mainTexture = breakJoints._hangingObject.renderer.material.mainTexture;
                    destroyedFood.transform.position            = breakJoints._hangingObject.transform.position;

                    breakJoints.breakRopeNow();
                    ickyCorrentAnswer(destroyedFood);
                    StartCoroutine(breakJoints.deleteRopeCutUp(1.0f));
                    _totalAnswersCount--;
                    Debug.Log("answerCount:" + _totalAnswersCount);
                }
                else if (hit.collider.name != questionTitle)
                {
                    isTouchEnabled = false;
                    isWrongAnswer  = true;
                    createCrossSign();
                    ickyWrongAnswer();
                    StartCoroutine(destroyCreatedObject(qCrossObj, 0.2f));
                }
            }
            else if (hit.collider.tag == "RopeCollider")
            {
                GameObject         ropeSwiped = hit.collider.gameObject.transform.parent.gameObject;
                NF_BreakRopeJoints ropeObj    = ropeSwiped.GetComponent <NF_BreakRopeJoints>();

                if (fruitObj != ropeObj._hangingObject)
                {
                    fruitObj = hit.collider.transform.gameObject;
                    qAttempts++;
                }
                if (ropeObj._hangingObject.name == questionTitle)
                {
                    NF_SoundManager.playSFX(ropeCutSFx);
                    isWrongAnswer = false;
                    selectedFruit = hit.transform.gameObject;
                    createTickSign();
                    StartCoroutine(destroyCreatedObject(qTickObj, 0.2f));

                    Transform rope = selectedFruit.transform.parent;
                    breakJoints = rope.GetComponent <NF_BreakRopeJoints>();
                    GameObject destroyedFood = Instantiate(EmptyFruit) as GameObject;
                    destroyedFood.transform.localScale          = breakJoints._hangingObject.transform.localScale;
                    destroyedFood.renderer.material.mainTexture = breakJoints._hangingObject.renderer.material.mainTexture;
                    destroyedFood.transform.position            = breakJoints._hangingObject.transform.position;

                    breakJoints.breakRopeNow();
                    ickyCorrentAnswer(destroyedFood);
                    StartCoroutine(breakJoints.deleteRopeCutUp(1.0f));
                    _totalAnswersCount--;
                    Debug.Log("answerCount:" + _totalAnswersCount);
                }
                else if (hit.collider.name != questionTitle)
                {
                    isTouchEnabled = false;
                    isWrongAnswer  = true;
                    createCrossSign();
                    ickyWrongAnswer();
                    StartCoroutine(destroyCreatedObject(qCrossObj, 0.2f));
                }
            }
        }
    }
コード例 #11
0
    void FingureGestures_OnTap(Vector2 fingurePos, int tapCount)
    {
        if (isTouchEnabled == false && isTouchesEnable_2 == false)
        {
            return;
        }
        RaycastHit hit;
        Ray        ray;

        ray = Camera.main.ScreenPointToRay(fingurePos);
        if (Physics.Raycast(ray, out hit, 10000))
        {
            CancelInvoke("playInstructionalVO");

            if (hit.collider.tag == "tag_Fruits")
            {
                qAttempts++;
                Debug.Log("QuestionAttempts:" + qAttempts);
                if (hit.collider.name == questionTitle)
                {
                    NF_SoundManager.playSFX(ropeCutSFx);
                    isWrongAnswer = false;
                    selectedFruit = hit.transform.gameObject;
                    createTickSign();
                    StartCoroutine(destroyCreatedObject(qTickObj, 0.2f));
                    Transform rope = selectedFruit.transform.parent;
                    breakJoints = rope.GetComponent <NF_BreakRopeJoints>();
                    GameObject destroyedFood = Instantiate(EmptyFruit) as GameObject;
                    destroyedFood.transform.localScale          = breakJoints._hangingObject.transform.localScale;
                    destroyedFood.renderer.material.mainTexture = breakJoints._hangingObject.renderer.material.mainTexture;
                    destroyedFood.transform.position            = breakJoints._hangingObject.transform.position;
                    breakJoints.breakRopeNow();
                    ickyCorrentAnswer(destroyedFood);
                    StartCoroutine(breakJoints.deleteRopeCutUp(1.0f));
                    _totalAnswersCount--;
                    if (_totalAnswersCount <= 0)
                    {
                        isTouchEnabled = false;
                        switchToNextQuestion();
                    }
                }
                else if (hit.collider.name != questionTitle)
                {
                    isWrongAnswer = true;
                    wrongAttempts++;
                    createCrossSign();
                    ickyWrongAnswer();
                    StartCoroutine(destroyCreatedObject(qCrossObj, 0.2f));
                    if (wrongAttempts == 5)
                    {
                        isTouchEnabled = false;
                        gameController.loadNextQuestion(0);
                    }
                }
            }
            else if (hit.collider.gameObject.name.Equals("Icky_Model"))
            {
                ickyGiggleAnimation();
            }
        }
        Invoke("playInstructionalVO", 10.0f);
    }