void olly_Walk_3(float xPos)
    {
        ollyStates = NF_OllyStates.olly_walking;
        createAnimations();
        Vector3 pos = transform.position;

        pos.x        = xPos;
        currentFrame = 0;
        iTween.MoveTo(gameObject, iTween.Hash("position", pos, "time", 25.0f / 50.0f, "onComplete", "switchToState", "oncompletetarget", gameObject, "oncompleteparams", NF_OllyStates.olly_blinking, "easetype", iTween.EaseType.linear));
    }
    void olly_WalkAgain_2(float xPos)
    {
        Debug.Log("walk again 2");
        ollyStates = NF_OllyStates.olly_walking2;
        createAnimations();
        Vector3 pos = transform.position;

        pos.x        = xPos;
        currentFrame = 0;
        iTween.MoveTo(gameObject, iTween.Hash("position", pos, "time", 18.0f / 50.0f, "onComplete", "olly_WalkAgain_3", "oncompletetarget", gameObject, "oncompleteparams", 475.0f, "easetype", iTween.EaseType.linear));
    }
 public void ollyTweenSequence(float xPos, float yPos, NF_OllyStates state)
 {
     ollyStates = state;
     if (ollyStates == NF_OllyStates.olly_walking)
     {
         Vector3 pos = transform.position;
         pos.x        = xPos;
         currentFrame = 0;
         iTween.MoveTo(gameObject, iTween.Hash("position", pos, "delay", 0.5f,
                                               "time", 25.0f / 50.0f, "easetype", iTween.EaseType.linear));
         iTween.RotateTo(gameObject, iTween.Hash("Quartenion", new Vector3(0, 0, 0), "delay", 0.5f, "time", 25.0f / 50.0f, "onComplete", "olly_Walk_2", "oncompletetarget", gameObject, "oncompleteparams", -350.0f));
     }
 }
    void olly_Walk_2(float xPos)
    {
        ollyStates = NF_OllyStates.olly_walking;
        createAnimations();
        Vector3 pos = transform.position;

        pos.x        = xPos;
        currentFrame = 0;

        iTween.MoveTo(gameObject, iTween.Hash("position", pos,
                                              "time", 25.0f / 50.0f, "easetype", iTween.EaseType.linear));
        iTween.RotateTo(gameObject, iTween.Hash("Quartenion", new Vector3(0, 0, 0), "time", 25.0f / 50.0f, "onComplete", "olly_Walk_3", "oncompletetarget", gameObject, "oncompleteparams", -100.0f));
    }
    public void olly_WalkAgain_1(float xPos)
    {
        Debug.Log("walk again 1");
        GameObject vine = GameObject.Find("Vine");

        ollyStates = NF_OllyStates.olly_walking2;
        createAnimations();
        Vector3 pos = transform.position;

        pos.x        = xPos;
        currentFrame = 0;

        iTween.MoveTo(gameObject, iTween.Hash("position", pos,
                                              "time", 18.0f / 50.0f, "easetype", iTween.EaseType.linear));
        iTween.RotateTo(gameObject, iTween.Hash("Quartenion", new Vector3(0, 0, 0), "time", 18.0f / 50.0f, "onComplete", "olly_WalkAgain_2", "oncompletetarget", gameObject, "oncompleteparams", 300.0f));
    }
    public void ollyIntroAnimation()
    {
        if(ollyStates == NF_OllyStates.unknown) {

            renderer.material.mainTexture = ollyImage;
            transform.localScale = new Vector3 (150, 280, 1);
            resetRotation();
            colCount = 1;
            rowCount = 1;
            colNumber = 0;
            rowNumber = 0;
            totalCells = 1;
            fps = 30;
            setCurrentFrame(0);

        }else if(ollyStates == NF_OllyStates.olly_idle) {

            renderer.material.mainTexture = idleSheet;
            transform.localScale = new Vector3 (150, 280, 1);

            colCount = 4;
            rowCount = 1;
            colNumber = 0;
            rowNumber = 0;
            totalCells = 4;
            fps = 10;

        }else if(ollyStates == NF_OllyStates.olly_walking){

            renderer.material.mainTexture =walkingSheet;
            transform.localScale = new Vector3(170,250,1);
            resetRotation();
            colCount = 6;
            rowCount = 3;
            colNumber = 0;
            rowNumber = 0;
            totalCells = 18;
            fps = 30;

            if(walkingFrames == null || walkingFrames.Count == 0)
                createAnimations();

            setCurrentFrame((int)walkingFrames[0]);
            walkingFrames.RemoveAt(0);
            if(walkingFrames.Count == 0) {
                currentFrame=0;
                fps = 30;
                ollyStates = NF_OllyStates.olly_blinking;
                createAnimations();
            }
        }
        else if(ollyStates == NF_OllyStates.olly_walking2){

            renderer.material.mainTexture =walkingSheet;
            transform.localScale = new Vector3(170,250,1);
            resetRotation();
            colCount = 6;
            rowCount = 3;
            colNumber = 0;
            rowNumber = 0;
            totalCells = 18;
            fps = 30;

            if(walkingFrames == null || walkingFrames.Count == 0)
                createAnimations();

            setCurrentFrame((int)walkingFrames[0]);
            walkingFrames.RemoveAt(0);
            if(walkingFrames.Count == 0) {
                currentFrame=0;
                fps = 30;
                ollyStates = NF_OllyStates.olly_handsUp;
                createAnimations();
            }
        }
        else if(ollyStates == NF_OllyStates.olly_handsUp){

            renderer.material.mainTexture =handsUpSheet;
            transform.localScale = new Vector3(150,280,1);
            resetRotation();
            colCount = 4;
            rowCount = 2;
            colNumber = 0;
            rowNumber = 0;
            totalCells = 7;
            fps = 30;

            if(handsUpFrames== null || handsUpFrames.Count == 0)
                createAnimations();

            setCurrentFrame((int)handsUpFrames[0]);
            handsUpFrames.RemoveAt(0);
            if(handsUpFrames.Count == 0) {
                currentFrame=0;
                fps = 30;
                ollyStates = NF_OllyStates.olly_stretch;
                createAnimations();
                ollyStretchSequence(550.0f);
            }
        }
        else if(ollyStates == NF_OllyStates.olly_blinking){

            renderer.material.mainTexture = blinkingSheet;
            transform.localScale = new Vector3(150,280,1);
            resetRotation();
            colCount = 4;
            rowCount = 2;
            colNumber = 0;
            rowNumber = 0;
            totalCells = 7;
            fps = 17;

            if(blinkingFrames == null || blinkingFrames.Count == 0)
                createAnimations();

            setCurrentFrame((int)blinkingFrames[0]);
            blinkingFrames.RemoveAt(0);
            if(blinkingFrames.Count == 0){
                currentFrame=0;
                fps = 30;
                ollyStates = NF_OllyStates.olly_walking2;
                createAnimations();
                olly_WalkAgain_1(150.0f);

            }
        } else if(ollyStates == NF_OllyStates.olly_stretch){

            renderer.material.mainTexture = stretchSheet;
            transform.localScale = new Vector3(160,300,1);
            resetRotation();
            colCount = 3;
            rowCount = 1;
            colNumber = 0;
            rowNumber = 0;
            totalCells = 3;
            fps =30;

            if(stretchFrames == null || stretchFrames.Count == 0)
                return;
            setCurrentFrame((int)stretchFrames[0]);
            stretchFrames.RemoveAt(0);
            if(stretchFrames.Count == 0) {
                currentFrame=0;
                fps = 30;
                Debug.Log("Animation Finished");
            }
        }
    }
 void switchState(NF_OllyStates state)
 {
     ollyStates = state;
         createAnimations();
 }
 void olly_Walk_3(float xPos)
 {
     ollyStates = NF_OllyStates.olly_walking;
             createAnimations();
             Vector3 pos = transform.position;
             pos.x = xPos;
             currentFrame = 0;
             iTween.MoveTo(gameObject, iTween.Hash("position", pos, "time", 25.0f/50.0f,"onComplete", "switchToState", "oncompletetarget", gameObject,"oncompleteparams",NF_OllyStates.olly_blinking,"easetype", iTween.EaseType.linear));
 }
    void olly_Walk_2(float xPos)
    {
        ollyStates = NF_OllyStates.olly_walking;
                createAnimations();
                Vector3 pos = transform.position;
                pos.x = xPos;
                currentFrame = 0;

            iTween.MoveTo(gameObject, iTween.Hash("position", pos,
            "time", 25.0f/50.0f, "easetype", iTween.EaseType.linear));
            iTween.RotateTo(gameObject, iTween.Hash("Quartenion",new Vector3(0,0,0),"time", 25.0f/50.0f, "onComplete", "olly_Walk_3", "oncompletetarget", gameObject, "oncompleteparams", -100.0f));
    }
 void olly_WalkAgain_3(float xPos)
 {
     Debug.Log("walk again 3");
             ollyStates = NF_OllyStates.olly_walking2;
             createAnimations();
             Vector3 pos = transform.position;
             pos.x = xPos;
             currentFrame = 0;
             iTween.MoveTo(gameObject, iTween.Hash("position", pos, "time", 18.0f/50.0f,"onComplete", "switchToState", "oncompletetarget", gameObject,"oncompleteparams",NF_OllyStates.olly_handsUp,"easetype", iTween.EaseType.linear));
 }
    public void olly_WalkAgain_1(float xPos)
    {
        Debug.Log("walk again 1");
            GameObject vine = GameObject.Find("Vine");
            ollyStates = NF_OllyStates.olly_walking2;
            createAnimations();
            Vector3 pos = transform.position;
            pos.x = xPos;
            currentFrame = 0;

            iTween.MoveTo(gameObject, iTween.Hash("position", pos,
            "time",18.0f/50.0f, "easetype", iTween.EaseType.linear));
            iTween.RotateTo(gameObject, iTween.Hash("Quartenion",new Vector3(0,0,0),"time", 18.0f/50.0f, "onComplete", "olly_WalkAgain_2", "oncompletetarget", gameObject, "oncompleteparams", 300.0f));
    }
    public void ollyTweenSequence(float xPos,float yPos,NF_OllyStates state)
    {
        ollyStates = state;
        if(ollyStates == NF_OllyStates.olly_walking){
                Vector3 pos = transform.position;
                pos.x = xPos;
                currentFrame = 0;
            iTween.MoveTo(gameObject, iTween.Hash("position", pos,"delay", 0.5f,
            "time", 25.0f/50.0f, "easetype", iTween.EaseType.linear));
            iTween.RotateTo(gameObject, iTween.Hash("Quartenion",new Vector3(0,0,0),"delay", 0.5f,"time", 25.0f/50.0f, "onComplete", "olly_Walk_2", "oncompletetarget", gameObject, "oncompleteparams", -350.0f));

            }
    }
    public void ollyIntroAnimation()
    {
        if (ollyStates == NF_OllyStates.unknown)
        {
            renderer.material.mainTexture = ollyImage;
            transform.localScale          = new Vector3(150, 280, 1);
            resetRotation();
            colCount   = 1;
            rowCount   = 1;
            colNumber  = 0;
            rowNumber  = 0;
            totalCells = 1;
            fps        = 30;
            setCurrentFrame(0);
        }
        else if (ollyStates == NF_OllyStates.olly_idle)
        {
            renderer.material.mainTexture = idleSheet;
            transform.localScale          = new Vector3(150, 280, 1);

            colCount   = 4;
            rowCount   = 1;
            colNumber  = 0;
            rowNumber  = 0;
            totalCells = 4;
            fps        = 10;
        }
        else if (ollyStates == NF_OllyStates.olly_walking)
        {
            renderer.material.mainTexture = walkingSheet;
            transform.localScale          = new Vector3(170, 250, 1);
            resetRotation();
            colCount   = 6;
            rowCount   = 3;
            colNumber  = 0;
            rowNumber  = 0;
            totalCells = 18;
            fps        = 30;

            if (walkingFrames == null || walkingFrames.Count == 0)
            {
                createAnimations();
            }

            setCurrentFrame((int)walkingFrames[0]);
            walkingFrames.RemoveAt(0);
            if (walkingFrames.Count == 0)
            {
                currentFrame = 0;
                fps          = 30;
                ollyStates   = NF_OllyStates.olly_blinking;
                createAnimations();
            }
        }
        else if (ollyStates == NF_OllyStates.olly_walking2)
        {
            renderer.material.mainTexture = walkingSheet;
            transform.localScale          = new Vector3(170, 250, 1);
            resetRotation();
            colCount   = 6;
            rowCount   = 3;
            colNumber  = 0;
            rowNumber  = 0;
            totalCells = 18;
            fps        = 30;

            if (walkingFrames == null || walkingFrames.Count == 0)
            {
                createAnimations();
            }

            setCurrentFrame((int)walkingFrames[0]);
            walkingFrames.RemoveAt(0);
            if (walkingFrames.Count == 0)
            {
                currentFrame = 0;
                fps          = 30;
                ollyStates   = NF_OllyStates.olly_handsUp;
                createAnimations();
            }
        }
        else if (ollyStates == NF_OllyStates.olly_handsUp)
        {
            renderer.material.mainTexture = handsUpSheet;
            transform.localScale          = new Vector3(150, 280, 1);
            resetRotation();
            colCount   = 4;
            rowCount   = 2;
            colNumber  = 0;
            rowNumber  = 0;
            totalCells = 7;
            fps        = 30;

            if (handsUpFrames == null || handsUpFrames.Count == 0)
            {
                createAnimations();
            }

            setCurrentFrame((int)handsUpFrames[0]);
            handsUpFrames.RemoveAt(0);
            if (handsUpFrames.Count == 0)
            {
                currentFrame = 0;
                fps          = 30;
                ollyStates   = NF_OllyStates.olly_stretch;
                createAnimations();
                ollyStretchSequence(550.0f);
            }
        }
        else if (ollyStates == NF_OllyStates.olly_blinking)
        {
            renderer.material.mainTexture = blinkingSheet;
            transform.localScale          = new Vector3(150, 280, 1);
            resetRotation();
            colCount   = 4;
            rowCount   = 2;
            colNumber  = 0;
            rowNumber  = 0;
            totalCells = 7;
            fps        = 17;

            if (blinkingFrames == null || blinkingFrames.Count == 0)
            {
                createAnimations();
            }

            setCurrentFrame((int)blinkingFrames[0]);
            blinkingFrames.RemoveAt(0);
            if (blinkingFrames.Count == 0)
            {
                currentFrame = 0;
                fps          = 30;
                ollyStates   = NF_OllyStates.olly_walking2;
                createAnimations();
                olly_WalkAgain_1(150.0f);
            }
        }
        else if (ollyStates == NF_OllyStates.olly_stretch)
        {
            renderer.material.mainTexture = stretchSheet;
            transform.localScale          = new Vector3(160, 300, 1);
            resetRotation();
            colCount   = 3;
            rowCount   = 1;
            colNumber  = 0;
            rowNumber  = 0;
            totalCells = 3;
            fps        = 30;

            if (stretchFrames == null || stretchFrames.Count == 0)
            {
                return;
            }
            setCurrentFrame((int)stretchFrames[0]);
            stretchFrames.RemoveAt(0);
            if (stretchFrames.Count == 0)
            {
                currentFrame = 0;
                fps          = 30;
                Debug.Log("Animation Finished");
            }
        }
    }
 void switchState(NF_OllyStates state)
 {
     ollyStates = state;
     createAnimations();
 }