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(){vartopJawHeight=TopJaw.GetComponent<MeshRenderer>().bounds.size.y;varbottomJawHeight=BottomJaw.GetComponent<MeshRenderer>().bounds.size.y;if(TopJaw.localPosition.y-topJawHeight/2<BottomJaw.localPosition.y+bottomJawHeight/2)reverse=true;elseif(TopJaw.localPosition.y>initialTopJawY)reverse=false;if(!reverse){TopJaw.Translate(0,-0.01f*Speed,0,Space.World);BottomJaw.Translate(0,0.01f*Speed,0,Space.World);}else{TopJaw.Translate(0,0.01f*Speed,0,Space.World);BottomJaw.Translate(0,-0.01f*Speed,0,Space.World);}}}