// --------- Finger taps
    void FingerGestures_OnFingerTap( int fingerIndex, Vector2 fingerPos, int tapCount )
    {
        GameObject selection=PickObject(fingerPos);
        if(!enableTouchesFlag || selection==null )
            return;
        //	Debug.Log("in finger tap...");

        if(selection.name=="pg_olly" && jumpCount==0){
            int _tickle = Random.Range(1,4);
            soundManager.currentClips=new System.Collections.Generic.List<UnityEngine.AudioClip>();
            soundManager.playInstructionSound(new string[]{PG_Constants._soundclipPath + PG_Constants._tickle + string.Format("olly_tap_{0}" , _tickle)});

            if(ollyAnimationsSR.ollyState != ollyAnimationStates.olly_tickle) {
                PG_OllyAnimations.changeTexture = true;
            }
            ollyAnimationsSR.ollyState      = ollyAnimationStates.olly_tickle;
           	return;
        }else if(selection.name=="bubble_referent" || selection.name=="cross_tick_sign" || selection.name=="referent_hint" || selection.name=="referent_shape"){
             soundManager.currentClips=new System.Collections.Generic.List<UnityEngine.AudioClip>();
             soundManager.playInstructionSound(questionInstructionVO);

        }
        else if(selection.name=="pg_icky"){
            int _tickle = Random.Range(1,5);
            soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
            soundManager.playInstructionSound(new string[]{PG_Constants._soundclipPath + PG_Constants._tickle + string.Format("icky_tickle_{0}" , _tickle)});

            if(ickyAnimationsSR.ickyState != ickyAnimStates.icky_tickle) {
                PG_IckyAnimations.changeTexture = true;
            }
            ickyAnimationsSR.ickyState      = ickyAnimStates.icky_tickle;
           	return;
        }

        if (selection!=null){
            shapeStatController=selection.GetComponent<PG_ShapeStatController>();
            //StopAllCoroutines();
        }
        if(shapeStatController!=null && shapeStatController.getAnswerShape() && dragFingerIndex==-1){
            dragFingerIndex=fingerIndex;
            decideForTappedDraggedShape(selection);

            if((int)currentMode == (int)GameModes.mode_counting){
            countModeShapeNumber++;
            GameObject countingNumber = GameObject.Instantiate(GO_countingNumber) as GameObject;
                countingNumber.transform.parent = camera.transform;
            if(countingNumber!=null)
            countingPOPUPController 	= countingNumber.GetComponent<PG_CountingPopUpController>();
            if(countingPOPUPController!=null){
                    countingPOPUPController.showCountingNumber(countModeShapeNumber);
                }
            string	shapeClipName = null;
            string shapeName	  = pgDataManager.getQuestionTitle();
            if(countModeShapeNumber==1)
            shapeClipName = "word_"+ shapeName.ToLower();
            else shapeClipName = "word_"+shapeName.ToLower()+"s";
            soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
            soundManager.playInstructionSound(new string[]{PG_Constants._soundclipPath+ PG_Constants._counting + string.Format("number_{0}",countModeShapeNumber),
            PG_Constants._soundclipPath+ PG_Constants._basicShapes + shapeClipName});

            }
            else{
                soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
                soundManager.playSucess();
            }
            //StartCoroutine(playQuestionInstructionVO(10F));

        }
        else if(shapeStatController!=null && !shapeStatController.getAnswerShape() && dragFingerIndex==-1){

                    shapeStatController.shapeWrongTapAnimation();  // start wrong animation with VO
                    totalWrongAttempts++;
                    //StartCoroutine(playQuestionInstructionVO(5F));
                   if(ollyAnimationsSR.ollyState!=ollyAnimationStates.olly_wrongAnswer){
                    PG_OllyAnimations.changeTexture = true;
                    ollyAnimationsSR.ollyLastStat = ollyAnimationsSR.ollyState;
                    }
                    ollyAnimationsSR.ollyState = ollyAnimationStates.olly_wrongAnswer;
                    soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
                    soundManager.playWrongSound();
                    cross_tick_sign.transform.renderer.material.mainTexture=Resources.Load(PG_Constants._wrongTick) as Texture;
                    cross_tick_sign.transform.renderer.enabled=true;
                    StartCoroutine(unhideCrossSign(0.5F));
                    if(dragFingerIndex==fingerIndex && isRightShapeDragged && answerShapeDrag !=null){
                    decideForTappedDraggedShape(answerShapeDrag);

        }

        //				shapeStatController.shapeWrongTapAnimation();  // start wrong animation with VO
        //			    totalWrongAttempts++;
        //				//StartCoroutine(playQuestionInstructionVO(5F));
        //			 if(ollyAnimationsSR.ollyState!=ollyAnimationStates.olly_wrongAnswer){
        //				PG_OllyAnimations.changeTexture = true;
        //				ollyAnimationsSR.ollyLastStat = ollyAnimationsSR.ollyState;
        //				}
        //			ollyAnimationsSR.ollyState = ollyAnimationStates.olly_wrongAnswer;
        //			soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
        //			soundManager.playWrongSound();
        //			cross_tick_sign.transform.renderer.material.mainTexture=Resources.Load(PG_Constants._wrongTick) as Texture;
        //			cross_tick_sign.transform.renderer.enabled=true;
        //			//StartCoroutine(unhideCrossSign(0.5F));
        }
    }
Exemple #2
0
    // ------ Finger drag begin
    void FingerGestures_OnFingerDragBegin(int fingerIndex, Vector2 fingerPos, Vector2 startPos)
    {
        GameObject selection = PickObject(fingerPos);

        if (!enableTouchesFlag || selection == null)
        {
            return;
        }
        Debug.Log("in drag begin...");

        if (selection != null)
        {
            shapeStatController     = selection.GetComponent <PG_ShapeStatController>();
            isUserPlayedTheQuestion = true;
            StopAllCoroutines();
        }
        if (shapeStatController != null && shapeStatController.getAnswerShape() && dragFingerIndex == -1)
        {
            dragFingerIndex     = fingerIndex;
            answerShapeDrag     = selection;
            isRightShapeDragged = true;
            hideShadow(selection);

            if ((int)currentMode == (int)GameModes.mode_counting)
            {
                countModeShapeNumber++;
                GameObject countingNumber = GameObject.Instantiate(GO_countingNumber) as GameObject;
                countingNumber.transform.parent = camera.transform;
                if (countingNumber != null)
                {
                    countingPOPUPController = countingNumber.GetComponent <PG_CountingPopUpController>();
                }
                if (countingPOPUPController != null)
                {
                    countingPOPUPController.showCountingNumber(countModeShapeNumber);
                }
                string shapeClipName = null;
                string shapeName     = pgDataManager.getQuestionTitle();
                if (countModeShapeNumber == 1)
                {
                    shapeClipName = "word_" + shapeName.ToLower();
                }
                else
                {
                    shapeClipName = "word_" + shapeName.ToLower() + "s";
                }
                soundManager.currentClips = new System.Collections.Generic.List <UnityEngine.AudioClip>();
                soundManager.playInstructionSound(new string[] { PG_Constants._soundclipPath + PG_Constants._counting + string.Format("number_{0}", countModeShapeNumber),
                                                                 PG_Constants._soundclipPath + PG_Constants._basicShapes + shapeClipName });
            }
            else
            {
                soundManager.currentClips = new System.Collections.Generic.List <UnityEngine.AudioClip>();
                soundManager.playSucess();
            }
            StartCoroutine(playQuestionInstructionVO(5F));
        }
        else if (shapeStatController != null && !shapeStatController.getAnswerShape() && dragFingerIndex == -1)
        {
            shapeStatController.shapeWrongTapAnimation();                              // start wrong animation with VO
            PG_OllyAnimations.changeTexture = true;
            totalWrongAttempts++;
            StartCoroutine(playQuestionInstructionVO(5F));
            if (ollyAnimationsSR.ollyState != ollyAnimationStates.olly_wrongAnswer)
            {
                ollyAnimationsSR.ollyLastStat = ollyAnimationsSR.ollyState;
            }
            ollyAnimationsSR.ollyState = ollyAnimationStates.olly_wrongAnswer;
            soundManager.currentClips  = new System.Collections.Generic.List <UnityEngine.AudioClip>();
            soundManager.playWrongSound();
            cross_tick_sign.transform.renderer.material.mainTexture = Resources.Load(PG_Constants._wrongTick) as Texture;
            cross_tick_sign.transform.renderer.enabled = true;
            StartCoroutine(unhideCrossSign(0.5F));
            if (dragFingerIndex == fingerIndex && isRightShapeDragged && answerShapeDrag != null)
            {
                decideForTappedDraggedShape(answerShapeDrag);
            }
        }
    }
    // ------ Finger drag begin
    void FingerGestures_OnFingerDragBegin( int fingerIndex, Vector2 fingerPos, Vector2 startPos )
    {
        GameObject selection = PickObject(fingerPos);

        if(!enableTouchesFlag || selection==null )
            return;
        Debug.Log("in drag begin...");

        if (selection!=null){
            shapeStatController=selection.GetComponent<PG_ShapeStatController>();
            isUserPlayedTheQuestion = true;
            StopAllCoroutines();
        }
        if(shapeStatController!=null && shapeStatController.getAnswerShape() && dragFingerIndex==-1){
                dragFingerIndex=fingerIndex;
                answerShapeDrag=selection;
                isRightShapeDragged=true;
                hideShadow(selection);

            if((int)currentMode == (int)GameModes.mode_counting){
            countModeShapeNumber++;
            GameObject countingNumber = GameObject.Instantiate(GO_countingNumber) as GameObject;
                countingNumber.transform.parent = camera.transform;
            if(countingNumber!=null)
            countingPOPUPController 	= countingNumber.GetComponent<PG_CountingPopUpController>();
            if(countingPOPUPController!=null){
               countingPOPUPController.showCountingNumber(countModeShapeNumber);
            }
            string	shapeClipName = null;
            string shapeName	  = pgDataManager.getQuestionTitle();
            if(countModeShapeNumber==1)
            shapeClipName = "word_"+ shapeName.ToLower();
            else shapeClipName = "word_"+shapeName.ToLower()+"s";
            soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
            soundManager.playInstructionSound(new string[]{PG_Constants._soundclipPath+ PG_Constants._counting + string.Format("number_{0}",countModeShapeNumber),
            PG_Constants._soundclipPath+ PG_Constants._basicShapes + shapeClipName});

            }
            else{
                soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
                soundManager.playSucess();
            }
            StartCoroutine(playQuestionInstructionVO(5F));

        }
        else if(shapeStatController!=null && !shapeStatController.getAnswerShape() && dragFingerIndex==-1){
                    shapeStatController.shapeWrongTapAnimation();  // start wrong animation with VO
                    PG_OllyAnimations.changeTexture = true;
                    totalWrongAttempts++;
                    StartCoroutine(playQuestionInstructionVO(5F));
                   if(ollyAnimationsSR.ollyState!=ollyAnimationStates.olly_wrongAnswer){
                    ollyAnimationsSR.ollyLastStat = ollyAnimationsSR.ollyState;
                    }
                    ollyAnimationsSR.ollyState = ollyAnimationStates.olly_wrongAnswer;
                    soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
                    soundManager.playWrongSound();
            cross_tick_sign.transform.renderer.material.mainTexture=Resources.Load(PG_Constants._wrongTick) as Texture;
                    cross_tick_sign.transform.renderer.enabled=true;
                    StartCoroutine(unhideCrossSign(0.5F));
        if(dragFingerIndex==fingerIndex && isRightShapeDragged && answerShapeDrag !=null){
                decideForTappedDraggedShape(answerShapeDrag);

        }
        }
    }
Exemple #4
0
    // --------- Finger taps
    void FingerGestures_OnFingerTap(int fingerIndex, Vector2 fingerPos, int tapCount)
    {
        GameObject selection = PickObject(fingerPos);

        if (!enableTouchesFlag || selection == null)
        {
            return;
        }
        //	Debug.Log("in finger tap...");


        if (selection.name == "pg_olly" && jumpCount == 0)
        {
            int _tickle = Random.Range(1, 4);
            soundManager.currentClips = new System.Collections.Generic.List <UnityEngine.AudioClip>();
            soundManager.playInstructionSound(new string[] { PG_Constants._soundclipPath + PG_Constants._tickle + string.Format("olly_tap_{0}", _tickle) });

            if (ollyAnimationsSR.ollyState != ollyAnimationStates.olly_tickle)
            {
                PG_OllyAnimations.changeTexture = true;
            }
            ollyAnimationsSR.ollyState = ollyAnimationStates.olly_tickle;
            return;
        }
        else if (selection.name == "bubble_referent" || selection.name == "cross_tick_sign" || selection.name == "referent_hint" || selection.name == "referent_shape")
        {
            soundManager.currentClips = new System.Collections.Generic.List <UnityEngine.AudioClip>();
            soundManager.playInstructionSound(questionInstructionVO);
        }
        else if (selection.name == "pg_icky")
        {
            int _tickle = Random.Range(1, 5);
            soundManager.currentClips = new System.Collections.Generic.List <UnityEngine.AudioClip>();
            soundManager.playInstructionSound(new string[] { PG_Constants._soundclipPath + PG_Constants._tickle + string.Format("icky_tickle_{0}", _tickle) });

            if (ickyAnimationsSR.ickyState != ickyAnimStates.icky_tickle)
            {
                PG_IckyAnimations.changeTexture = true;
            }
            ickyAnimationsSR.ickyState = ickyAnimStates.icky_tickle;
            return;
        }

        if (selection != null)
        {
            shapeStatController = selection.GetComponent <PG_ShapeStatController>();
            //StopAllCoroutines();
        }
        if (shapeStatController != null && shapeStatController.getAnswerShape() && dragFingerIndex == -1)
        {
            dragFingerIndex = fingerIndex;
            decideForTappedDraggedShape(selection);

            if ((int)currentMode == (int)GameModes.mode_counting)
            {
                countModeShapeNumber++;
                GameObject countingNumber = GameObject.Instantiate(GO_countingNumber) as GameObject;
                countingNumber.transform.parent = camera.transform;
                if (countingNumber != null)
                {
                    countingPOPUPController = countingNumber.GetComponent <PG_CountingPopUpController>();
                }
                if (countingPOPUPController != null)
                {
                    countingPOPUPController.showCountingNumber(countModeShapeNumber);
                }
                string shapeClipName = null;
                string shapeName     = pgDataManager.getQuestionTitle();
                if (countModeShapeNumber == 1)
                {
                    shapeClipName = "word_" + shapeName.ToLower();
                }
                else
                {
                    shapeClipName = "word_" + shapeName.ToLower() + "s";
                }
                soundManager.currentClips = new System.Collections.Generic.List <UnityEngine.AudioClip>();
                soundManager.playInstructionSound(new string[] { PG_Constants._soundclipPath + PG_Constants._counting + string.Format("number_{0}", countModeShapeNumber),
                                                                 PG_Constants._soundclipPath + PG_Constants._basicShapes + shapeClipName });
            }
            else
            {
                soundManager.currentClips = new System.Collections.Generic.List <UnityEngine.AudioClip>();
                soundManager.playSucess();
            }
            //StartCoroutine(playQuestionInstructionVO(10F));
        }
        else if (shapeStatController != null && !shapeStatController.getAnswerShape() && dragFingerIndex == -1)
        {
            shapeStatController.shapeWrongTapAnimation();                              // start wrong animation with VO
            totalWrongAttempts++;
            //StartCoroutine(playQuestionInstructionVO(5F));
            if (ollyAnimationsSR.ollyState != ollyAnimationStates.olly_wrongAnswer)
            {
                PG_OllyAnimations.changeTexture = true;
                ollyAnimationsSR.ollyLastStat   = ollyAnimationsSR.ollyState;
            }
            ollyAnimationsSR.ollyState = ollyAnimationStates.olly_wrongAnswer;
            soundManager.currentClips  = new System.Collections.Generic.List <UnityEngine.AudioClip>();
            soundManager.playWrongSound();
            cross_tick_sign.transform.renderer.material.mainTexture = Resources.Load(PG_Constants._wrongTick) as Texture;
            cross_tick_sign.transform.renderer.enabled = true;
            StartCoroutine(unhideCrossSign(0.5F));
            if (dragFingerIndex == fingerIndex && isRightShapeDragged && answerShapeDrag != null)
            {
                decideForTappedDraggedShape(answerShapeDrag);
            }


//				shapeStatController.shapeWrongTapAnimation();  // start wrong animation with VO
//			    totalWrongAttempts++;
//				//StartCoroutine(playQuestionInstructionVO(5F));
//			 if(ollyAnimationsSR.ollyState!=ollyAnimationStates.olly_wrongAnswer){
//				PG_OllyAnimations.changeTexture = true;
//				ollyAnimationsSR.ollyLastStat = ollyAnimationsSR.ollyState;
//				}
//			ollyAnimationsSR.ollyState = ollyAnimationStates.olly_wrongAnswer;
//			soundManager.currentClips = new System.Collections.Generic.List<UnityEngine.AudioClip>();
//			soundManager.playWrongSound();
//			cross_tick_sign.transform.renderer.material.mainTexture=Resources.Load(PG_Constants._wrongTick) as Texture;
//			cross_tick_sign.transform.renderer.enabled=true;
//			//StartCoroutine(unhideCrossSign(0.5F));
        }
    }