Game Development Reference
In-Depth Information
Engage thrusters
Let's get started! To add new features to the
CharacterControl
and
CameraCon-
trol
scripts, perform the following steps:
1. Go to the
Chapter5/Scripts/C#
(for C# users) or
Chapter5/Scripts/
Javascript
(for Unity JavaScript users) folder in the
Project
view and double-
click on the
CharacterControl
script file to open it, as we can see in the fol-
lowing screenshot:
2. Open the
ChracterControl
script file; add the following highlighted script in
the variable area as follows:
// Unity JavaScript user:
public enum MOTION_STATE
{GROUND,JUMP,FALL,JUMP_HOLD,AIM}
…
private var _currentEulerAngle : Vector3;
private var _isAiming : boolean;
private var _isShot : boolean;
…
function get IsFall () : boolean {
return (_inAirTime > MIN_AIR_TIME);
}