// set initial gravity public void Init(GravityOrientation initOr, float intensity) { gravityOr = initOr; SetGravityVector(intensity); roomHandler = GameObject.Find("roomManager"); var roomScript = roomHandler.GetComponent <roomManagement>(); int orient = roomScript.gravityDirection; if (orient == 1) { SetGravityOrientation(GravityOrientation.Up); } else if (orient == 2) { SetGravityOrientation(GravityOrientation.Right); } else if (orient == 3) { SetGravityOrientation(GravityOrientation.Left); } }
// other scripts call this to change the gravity orientation public void SetGravityOrientation(GravityOrientation newOr) { gravityOr = newOr; SetGravityVector(); }