void Animate() { if(mAnimateTime < Time.time) { mAnimateTime = TimeBetweenFrames + Time.time; if (mMaterials == MaterialsRat.Walking1) { mMaterials = MaterialsRat.Walking2; if (mDirection == 1) renderer.material = Walking2Left; else renderer.material = Walking2Right; } else if (mMaterials == MaterialsRat.Walking2) { mMaterials = MaterialsRat.Walking3; if(mDirection == 1) renderer.material = Walking3Left; else renderer.material = Walking3Right; } else if (mMaterials == MaterialsRat.Walking3) { mMaterials = MaterialsRat.Walking4; if(mDirection == 1) renderer.material = Walking4Left; else renderer.material = Walking4Right; } else if (mMaterials == MaterialsRat.Walking4) { mMaterials = MaterialsRat.Walking1; if(mDirection == 1) renderer.material = Walking1Left; else renderer.material = Walking1Right; } } }
// Use this for initialization void Start() { life = MAXLIFE; mMaterials = MaterialsRat.Walking1; }