Unity Learn home
0
0
Jumping Cubes
42 views
Three differently colored cubes can be selected by hovering over them with the mouse. Upon doing so, they will start to float and a spotlight illuminates the selected cube. When clicking on the cubes, they jump up. The general behavior of the cubes (floating, being illuminated) is stored in a Parent Class in different methods, applying the concept of abstraction. The different cubes inherit from this class and override the jump method to make them jump to different heights, applying polymorphism. Lastly, the height at which the cubes float is encapsulated such that it cannot be set to negative heights.
Media
1
1