Difference between revisions of "AutoScrollWithOverride"
(Initial page, includes API information and categories) |
Latest revision as of 19:10, 15 April 2013
This script will move an object along the X, Y plane at a constant rate until the screen is touched or until it reaches a boundary. Boundaries for the object are set in the custom editor interface for this script. A person touching or clicking the screen will cause the object to move. If the person attempts to move the object outside the boundaries, the object will move less and less the further away from the boundary it gets. When they stop pressing the screen, the object will spring back to the boundary.
It should be noted that the boundary positions in this script may seem backwards at first, but that is by design. This script was originally written to move text across the screen. The positions define where the corresponding edges of the object should be and are not relative to each other. This means that the Top Position is usually below the Bottom Position, and the Left and Right positions are generally reversed. See the AutoScrollWithOverride Demo for more information.
[edit] Public Variables
[edit] autoScroll : Vector2
This is how fast, and in what direction, the object should automatically scroll.
[edit] disableAutoScrollOnTouch : bool
If set to true, once someone touches or clicks on the screen, the object will cease to auto scroll.
[edit] reEnableAutoScroll : bool
If set to true, when the script is enabled, the position of the object will be immediately set to the Top Position, and auto scrolling will be turned on.
[edit] dragScaleFactor : float
This determines how far the object will move when someone is pressing or clicking on the screen.
[edit] movementAxis : Axis
This determines what directions the object will be allowed to move. This affects the autoScroll vector as well as a person dragging the object.
Possible values for this variable are:
- X
- Y
- X_AND_Y
[edit] boundarySize : float
The size of the boundary limit. It is used to affect how far the person can drag the object outside of the boundary. It should be a positive number, usually between 0 and 1.
[edit] recoverSpeed : float
This is how fast the object will scroll to the top of the screen if ScrollToTop is called.
[edit] TopPosition : Vector3
This is the position of the top boundary.
[edit] BottomPosition : Vector3
This is the position of the bottom boundary.
[edit] LeftPosition : Vector3
This is the position of the left boundary.
[edit] RightPosition : Vector3
This is the position of the right boundary.
[edit] Public Functions
[edit] void ScrollToTop ()
This may be called to kill any movement of the object and scroll it quickly to the top position. A good way to use this script is in conjunction with an InvisibleButton, where the button sends this message to this script.