VDP-noclip / noclip

NOCLIP is an experimental game in which you “noclip” the environment to solve puzzles.
3 stars 1 forks source link

Add a new noclip object type and the related controller script #48

Closed spig95 closed 2 years ago

spig95 commented 2 years ago

Changes

Remarks

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 type BaseNoclipObjectController (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

spig95 commented 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 :)

bottolo commented 2 years ago

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!