// ---- jump land to first landmass
    public void playJumpLandToWaterAnim()
    {
        if (jumpLandToWaterFrames != null && jumpLandToWaterFrames.Count > 0)
        {
            setCurrentFrame((int)jumpLandToWaterFrames[0]);
            jumpLandToWaterFrames.RemoveAt(0);
        }

        if (jumpLandToWaterFrames == null || jumpLandToWaterFrames.Count == 0)
        {
            createLandToWaterAnim();
            gameController.setFingerIndexOnAnimationComplete();


            if (!isLastShape)
            {
                //Debug.Log("Enabling touches and showing referent bubble");
                gameController.showReferentBubble();
                gameController.enableTouchesFlag = true;
            }


            if (answerShapesCount >= 2)
            {
                changeTexture = true;
                ollyState     = ollyAnimationStates.olly_hop;

                Vector3 pos = transform.localPosition;
                //pos.y += 75.5F;
                transform.localPosition = pos;
            }

            //else ollyState =  ollyAnimationStates.olly_jumpWaterToLand;
        }
    }
    IEnumerator setFlag(float time, ollyAnimationStates stat)
    {
        yield return(new WaitForSeconds(time));

        if (isAnimating)
        {
            ollyState     = stat;
            changeTexture = true;
        }
    }
 // ---- idle animation
 public void playIdle1Anim()
 {
     if (idleAnimFrames != null && idleAnimFrames.Count > 0)
     {
         setCurrentFrame((int)idleAnimFrames[0]);
         idleAnimFrames.RemoveAt(0);
     }
     if (idleAnimFrames.Count == 0)
     {
         ollyState = ollyAnimationStates.olly_still;
         createIdleAnim();
     }
 }
 // ---- tickle animation
 public void playTickleAnim()
 {
     if (tickleFrames.Count > 0)
     {
         setCurrentFrame((int)tickleFrames[0]);
         tickleFrames.RemoveAt(0);
     }
     if (tickleFrames.Count == 0)
     {
         createTickleAnim();
         changeTexture = true;
         ollyState     = ollyAnimationStates.olly_idle1;
     }
 }
 // ---- celebration aniamtion
 private void playCelebrationAnim()
 {
     if (celebrationFrames.Count > 0)
     {
         setCurrentFrame((int)celebrationFrames[0]);
         celebrationFrames.RemoveAt(0);
     }
     if (celebrationFrames.Count == 0)
     {
         ollyState     = ollyAnimationStates.olly_idle1;
         changeTexture = true;
         gameController.loadLevelOrQuestion();
         createCelebrationAnim();
     }
 }
    void Start()
    {
        isAnimating   = true;
        changeTexture = true;
        ollyState     = ollyAnimationStates.olly_idle1;
        ollyPrevState = ollyState;

        camera         = GameObject.Find("Camera");
        gameController = camera.GetComponent <PG_GameController>();

        if (shapesRefrence != null)
        {
            soundManager = shapesRefrence.GetComponent <PG_SoundManager>();
        }
    }
    void Update()
    {
        int index = (int)(Time.time * fps);

        if (ollyState != ollyPrevState)
        {
            ollyPrevState = ollyState;
            playOlly_Animations();
        }
        else if (index > currentFrame)
        {
            currentFrame = index;
            playOlly_Animations();
        }
    }
 // ---- 1. water to land animation ----- 2. on reaching land celebration aniamtion
 public void playJumpWaterToLandAnim()
 {
     if (jumpWaterToLand.Count > 0)
     {
         setCurrentFrame((int)jumpWaterToLand[0]);
         jumpWaterToLand.RemoveAt(0);
         if (jumpWaterToLand.Count == 0)
         {
             gameController.playCelebrationVoiceOvers();
             gameController.setFingerIndexOnAnimationComplete();
             changeTexture = true;
             ollyState     = ollyAnimationStates.olly_celebration;
             createWaterToLandAnim();
         }
     }
 }
 private void playWeapAnim()
 {
     if (weapFrames.Count > 0)
     {
         setCurrentFrame((int)weapFrames[0]);
         weapFrames.RemoveAt(0);
     }
     if (weapFrames.Count == 0)
     {
         createWeapAnim();
         changeTexture = true;
         ollyState     = ollyAnimationStates.olly_idle1;
         gameController.setFingerIndexOnAnimationComplete();
         gameController.loadLevelOrQuestion();
     }
 }
    // ---- jump one landmass to other landmass
    public void playJumpWaterToWaterAnim()
    {
        if (jumpWaterToWaterFrames.Count > 0)
        {
            setCurrentFrame((int)jumpWaterToWaterFrames[0]);
            jumpWaterToWaterFrames.RemoveAt(0);
        }
        if (jumpWaterToWaterFrames.Count == 0)
        {
            gameController.setFingerIndexOnAnimationComplete();

            if (!isLastShape)
            {
                gameController.showReferentBubble();
                gameController.enableTouchesFlag = true;
            }
            createWaterToWaterAnim();
            changeTexture = true;
            ollyState     = ollyAnimationStates.olly_hop;
        }
    }
 private void playWrongAnswerAnim()
 {
     if (wrongAnswerFrames.Count > 0)
     {
         setCurrentFrame((int)wrongAnswerFrames[0]);
         wrongAnswerFrames.RemoveAt(0);
     }
     if (wrongAnswerFrames.Count == 0)
     {
         createWrongAnswerAnim();
         changeTexture = true;
         if (ollyLastStat == ollyAnimationStates.olly_still)
         {
             ollyState = ollyAnimationStates.olly_idle1;
         }
         else
         {
             ollyState = ollyLastStat;
         }
     }
 }
    void Update()
    {
        int index  = (int)(Time.time * fps);

        if(ollyState!=ollyPrevState)
        {
            ollyPrevState = ollyState;
            playOlly_Animations();
        }
        else if(index > currentFrame) {
            currentFrame = index;
            playOlly_Animations();
        }
    }
    void Start()
    {
        isAnimating   = true;
        changeTexture = true;
        ollyState 	  = ollyAnimationStates.olly_idle1;
        ollyPrevState = ollyState;

        camera 				= 	GameObject.Find("Camera");
        gameController		= camera.GetComponent<PG_GameController>();

        if(shapesRefrence!=null)
        soundManager = shapesRefrence.GetComponent<PG_SoundManager>();
    }
 IEnumerator setFlag(float time ,ollyAnimationStates stat)
 {
     yield return new WaitForSeconds(time);
     if(isAnimating){
         ollyState = stat;
         changeTexture = true;
     }
 }
 private void playWrongAnswerAnim()
 {
     if(wrongAnswerFrames.Count>0){
         setCurrentFrame((int)wrongAnswerFrames[0]);
         wrongAnswerFrames.RemoveAt(0);
     }
     if(wrongAnswerFrames.Count==0){
       	createWrongAnswerAnim();
       	changeTexture = true;
      if(ollyLastStat==ollyAnimationStates.olly_still)
         ollyState = ollyAnimationStates.olly_idle1;
      else  ollyState = ollyLastStat;
     }
 }
 private void playWeapAnim()
 {
     if(weapFrames.Count>0){
         setCurrentFrame((int)weapFrames[0]);
         weapFrames.RemoveAt(0);
     }
     if(weapFrames.Count==0){
          createWeapAnim();
          changeTexture = true;
         ollyState = ollyAnimationStates.olly_idle1;
         gameController.setFingerIndexOnAnimationComplete();
         gameController.loadLevelOrQuestion();
     }
 }
 // ---- celebration aniamtion
 private void playCelebrationAnim()
 {
     if(celebrationFrames.Count>0){
         setCurrentFrame((int)celebrationFrames[0]);
         celebrationFrames.RemoveAt(0);
     }
     if(celebrationFrames.Count==0){
         ollyState = ollyAnimationStates.olly_idle1;
         changeTexture = true;
         gameController.loadLevelOrQuestion();
         createCelebrationAnim();
     }
 }
 // ---- tickle animation
 public void playTickleAnim()
 {
     if(tickleFrames.Count>0){
         setCurrentFrame((int)tickleFrames[0]);
         tickleFrames.RemoveAt(0);
     }
     if(tickleFrames.Count==0){
       createTickleAnim();
       changeTexture = true;
       ollyState = ollyAnimationStates.olly_idle1;
     }
 }
    // ---- jump one landmass to other landmass
    public void playJumpWaterToWaterAnim()
    {
        if(jumpWaterToWaterFrames.Count>0){
            setCurrentFrame((int)jumpWaterToWaterFrames[0]);
            jumpWaterToWaterFrames.RemoveAt(0);
        }
        if(jumpWaterToWaterFrames.Count==0){
            gameController.setFingerIndexOnAnimationComplete();

        if(!isLastShape){
            gameController.showReferentBubble();
            gameController.enableTouchesFlag = true;
        }
          createWaterToWaterAnim();
          changeTexture=true;
          ollyState =  ollyAnimationStates.olly_hop;
        }
    }
 // ---- idle animation
 public void playIdle1Anim()
 {
     if(idleAnimFrames!=null && idleAnimFrames.Count>0){
         setCurrentFrame((int)idleAnimFrames[0]);
         idleAnimFrames.RemoveAt(0);
     }
     if(idleAnimFrames.Count==0){
             ollyState=ollyAnimationStates.olly_still;
             createIdleAnim();
         }
 }
    // ---- jump land to first landmass
    public void playJumpLandToWaterAnim()
    {
        if(jumpLandToWaterFrames!=null && jumpLandToWaterFrames.Count>0){
            setCurrentFrame((int)jumpLandToWaterFrames[0]);
            jumpLandToWaterFrames.RemoveAt(0);
        }

        if(jumpLandToWaterFrames==null || jumpLandToWaterFrames.Count ==0){
            createLandToWaterAnim();
            gameController.setFingerIndexOnAnimationComplete();

            if(!isLastShape){
                //Debug.Log("Enabling touches and showing referent bubble");
                gameController.showReferentBubble();
                gameController.enableTouchesFlag = true;
            }

            if(answerShapesCount>=2){
                changeTexture=true;
                ollyState  =  ollyAnimationStates.olly_hop;

                Vector3 pos = transform.localPosition;
                //pos.y += 75.5F;
                transform.localPosition=pos;

            }

            //else ollyState =  ollyAnimationStates.olly_jumpWaterToLand;
        }
    }
 // ---- 1. water to land animation ----- 2. on reaching land celebration aniamtion
 public void playJumpWaterToLandAnim()
 {
     if(jumpWaterToLand.Count>0){
         setCurrentFrame((int)jumpWaterToLand[0]);
         jumpWaterToLand.RemoveAt(0);
     if(jumpWaterToLand.Count==0){
         gameController.playCelebrationVoiceOvers();
         gameController.setFingerIndexOnAnimationComplete();
         changeTexture=true;
         ollyState = ollyAnimationStates.olly_celebration;
         createWaterToLandAnim();
     }
     }
 }