Returning a Bool Status from Another Class Without Update()

I have three classes of C# things. One is a PuzzleController, another is a CameraGlide, and the last is a CameraRotate. Just a quick summary of what the 3 classes are. Controller has all the puzzle variables, trigger actions, stuff to send to UI, and controls what state the puzzle is in. CameraGlide moves the camera from one point to another while looking at a point. CameraRotate allows the player to mouse drag the mouse around a point and zoom in/out.

What I want to do is this:

-Player walks into trigger

-Camera disables 3rdPersonCamera

-Camera glides from behind player to predetermined puzzle location

-Tells the Controller when the camera has reached the puzzle position

-PuzzleController turns off the glide and turns on the Rotate

-Player out of trigger

-Turn off CameraRotate

-CameraGlides from where it is to the player

-Tells the controller when the camera has reached the player position

-Turn back on 3rdPersonCamera

The problem is the sequence of events. CameraGlide and CameraRotate should be PuzzleController agnostic (there different classes of controllers at different levels). So I don’t want to hard code anything into Glide Update() something like:

“if(at_loc) Puz_Con_A.glideDone()”.

Because now this Glide class only works with the one type of controller. Similarly I don’t want a constantly running update in the PuzzleController checking the status of the Glide like:

“if(glide.at_loc =true)”.

Since this would be constantly checking when it only needs to be when the player has triggered the puzzle.

Ideally I want to use some kind of Delegate/Listener that any PuzzleController can add to their own code so that when it triggers it tells the CameraGlide, and listens for CameraGlide to send back that it’s at the location. The problem is I’m terrible at Listeners and I’m not sure how to add it while keeping CameraGlide and CameraRotate agnostic.

Put references to your scripts and call the methods you want from the other scripts…
So like in Player or your trigger object you have OnTriggerEnter() you also need a reference to your other object you can assign manually in inspector or in Start() or Awake() in OnTriggerEnter() method you call the methods to disable 3rd person camera, move it, you need a method or bool for when the camera is setup, etc… Then you use OnTriggerExit() to call the other methods you want…