Game Development Reference
In-Depth Information
}
}
// C# user:
void OnAnimatorMove (){
if (_animator) {
if (_isJumping) {
} else {
if (IsFall) {
} else {
if (_isAiming) {
_motionState = MOTION_STATE.AIM;
} else {
_motionState = MOTION_STATE.GROUND;
}
}
}
_animator.SetFloat ("Speed", _moveSpeed);
_animator.SetBool ("IsShot", _isShot);
_animator.SetInteger ("MotionState",
(int)_motionState);
}
}
6. We have finished setting up the CharacterControl script. Now, we will go
to the CameraControl script. Let's go to the Chapter5/Scripts/C# (for
C# users) or Chapter5/Scripts/Javascript (for Unity JavaScript users)
folder in the Project view. Double-click on the CameraControl script and add
the variables as follows:
// Unity JavaScript user:
var heightSmoothTime : float = 0.1f;
var distanceAimming : float = 1.5f;
var distance : float = 2.5f;
var height : float = 1.0f;
Search WWH ::




Custom Search