void Animate()
    {
        if (mAnimateTime < Time.time)
        {

            mAnimateTime = TimeBetweenFrames + Time.time;

            if (mMaterials == MaterialsGoblin.Walking1)
            {
                mMaterials = MaterialsGoblin.Walking2;
                if (mDirection == 1)
                    renderer.material = Walking2Left;
                else
                    renderer.material = Walking2Right;
            }

            else if (mMaterials == MaterialsGoblin.Walking2)
            {

                mMaterials = MaterialsGoblin.Walking3;
                if (mDirection == 1)
                    renderer.material = Walking3Left;
                else
                    renderer.material = Walking3Right;
            }

            else if (mMaterials == MaterialsGoblin.Walking3)
            {
                mMaterials = MaterialsGoblin.Walking4;
                if (mDirection == 1)
                    renderer.material = Walking4Left;
                else
                    renderer.material = Walking4Right;
            }

            else if (mMaterials == MaterialsGoblin.Walking4)
            {
                mMaterials = MaterialsGoblin.Walking5;
                if (mDirection == 1)
                    renderer.material = Walking5Left;
                else
                    renderer.material = Walking5Right;
            }

            else if (mMaterials == MaterialsGoblin.Walking5)
            {

                mMaterials = MaterialsGoblin.Walking1;
                if (mDirection == 1)
                    renderer.material = Walking1Left;
                else
                    renderer.material = Walking1Right;
            }
            else if (mMaterials == MaterialsGoblin.Standing)
            {
                if (mDirection == 1)
                    renderer.material = StandingLeft;
                else
                    renderer.material = StandingRight;
            }

        }
    }
 // Use this for initialization
 void Start()
 {
     mMaterials = MaterialsGoblin.Walking1;
     life = MAXLIFE;
 }
    // Update is called once per frame
    void Update()
    {
        isDead();
        Animate();
        if(mWalk)
        {
            Move();
        }

        if(mChangeTime <= Time.time)
        {
            mChangeTime = IntervalChance + Time.time;
            mWalk = true;
            mMaterials = MaterialsGoblin.Walking1;

            Change();
        }
    }
    void Change()
    {
        float tRandomNumber = Random.Range(1, 100);
        if (tRandomNumber <= ChanceToStop)
        {
            mWalk = false;
            mMaterials = MaterialsGoblin.Standing;
        }
        tRandomNumber = Random.Range(1, 100);
        if (tRandomNumber <= ChanceToWalk)
        {

        }
        tRandomNumber = Random.Range(1, 100);
        if (tRandomNumber <= ChanceToTurnAround)
        {
            mDirection *= -1;
        }
    }