Closed spig95 closed 2 years ago
We'll discuss class renaming this tuesday! Until then, this change seems natural. I wouldn't have come up with something like this.
Having a base controller makes things more organized and optimized; also, I've learned how to extend classes in C#.
Personal opinions aside, everything works as usual.
I had to resolve conflicts in Scene_3, but I did not make any change to my code. This resets the approval state, please have a look and if all works you can approve and merge :)
Strange, I was able to open the project without any particular problem! I'll check and approve as soon as possible.
Edit: I figured it out thanks to @spig95. Yay!
Changes
NoclipObjectControllers
folderBaseNoclipObjectController.cs
and make theNoclipObjController.cs
a child of this class.NoclipIntangibleController.cs
, which is also a child of the base controller class for Noclip objectsRemarks
Having a base class
BaseNoclipObjectController.cs
is particularly useful: the child class highlights the difference in the no clip object types, while the abstract one highlight the interface to the rest of the world.Moreover, in
NoclipManager
, we can make everything work with minor modifications. As you can see from the changes, we just take all the objects with the NoclipObject tag and get their components of typeBaseNoclipObjectController
(we exploit inheritance: the childs have the same type of the father). The NoclipManager does not need to know the different Noclip object types!This makes it really easy to add other noclip behaviours by simply creating a child noclip object controller class and attaching it to a given object with the
NoclipObject
tag