usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassRockJaws:MonoBehaviour{publicTransformTopJaw;publicTransformBottomJaw;publicintSpeed=10;privateboolreverse=false;privatefloatinitialTopJawY;// Start is called before the first frame updatevoidStart(){initialTopJawY=TopJaw.localPosition.y;}// Update is called once per framevoidUpdate(){}voidFixedUpdate(){if(TopJaw.localPosition.y<BottomJaw.localPosition.y)reverse=true;elseif(TopJaw.localPosition.y>initialTopJawY)reverse=false;if(!reverse){TopJaw.Translate(0,-0.01f*Speed,0);BottomJaw.Translate(0,0.01f*Speed,0);}else{TopJaw.Translate(0,0.01f*Speed,0);BottomJaw.Translate(0,-0.01f*Speed,0);}}}