Game Development Reference
In-Depth Information
Vector3 (0, _verticalSpeed, 0);
_movement *= Time.deltaTime;
if (_movement != Vector3.zero) {
_characterController.Move(_movement);
}
transform.eulerAngles = _currentEulerAngle;
if (_moveDirection != Vector3.zero) {
transform.rotation =
Quaternion.LookRotation(_moveDirection);
}
_currentEulerAngle = transform.eulerAngles;
}
5. Next, we go to the OnAnimatorMove() function to set up the
MOTION_STATE.AIM and IsShot parameters. Let's replace the code with fol-
lowing highlighted code:
// Unity JavaScript user:
function 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",
parseInt(_motionState));
Search WWH ::




Custom Search