Game Development Reference
In-Depth Information
}
}
Tip
#region YourComment - #endregion
In C#, we can put any script between
#region Your Code Discription
and
#endregion
to specify a block of code that we can expand or collapse by
clicking on the plus and minus sign in MonoDevelop.
We can see how to use
#region ….. #endregion
in the following screen-
shot:
Lastly, we will add the
OnDrawGizmos()
function in this class. It is a very nice
function that allows us to debug the game, the result of which we won't see in the
real game. Let's add the following block of code:
// Unity JavaScript user:
function OnDrawGizmos() {
_boxCollider2D = GetComponent.<BoxCollider2D>();
_height = _boxCollider2D.size.y;
var distance : float = (_height * RAYCAST_DISTANCE);