Originally Posted By: AlbertoT
Quote:
Actually that's encapsulation -- a design decision that any object should only be manipulable using its own methods. It's relatively "safe", but sometimes a fella just wants to use good old-fashioned addition on a component he understands.

you refer to :
Camera.main.transform.Translate(move*Time.deltaTime);

Maybe I misunderstood what you said
Do you mean that the above code is a typical example of an object being manipulated by its own methods ?
If so, nope
It is the direct opposite

In the above code the object is "transform" which is an object of the class "Transform"
the class Transform contains the method Translate()
Unity instance the object "transform" in the background for you

"Camera" is a redundant term you could even omit it

This an example of component based programming
Originally Posted By: Unity Documentation
Every object in a scene has a Transform. It's used to store and manipulate the position, rotation and scale of the object. Every Transform can have a parent, which allows you to apply position, rotation and scale hierarchically. This is the hierarchy seen in the Hierarchy pane.
I am not experienced with Unity, but manipulating an object through its methods and not direct manipulation of its elements is encapsulation. The complaint is that instead of changing the camera's properties directly, the programmer must call a function to do it. That's encapsulation.

In this case the camera has a "transform", which is being manipulated through its own method "Translate" rather than directly changing/assigning values.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!