public void ToNormalState() { currentMotionState = new MoveMotionStateNormal(myAnimator); if (currentMotionState == null) { EB.Debug.LogError("currentMotionState == null"); } currentMotionState.freezeLocation = false; currentMotionState.isFinished = false; currentMotionState.exitFrame = -1.0f; }
public void JumpTo(Vector3 jumpDestination, AnimationCurve distanceCurve, float scale, Vector3 destinationOffset, float exitFrame) { currentMotionState = new MoveMotionStateJump(myAnimator); currentMotionState.destination = jumpDestination; currentMotionState.toDestinationNormalized = Vector3.Normalize(moveController.transform.position - currentMotionState.destination); currentMotionState.distanceToDestination = distanceCurve; currentMotionState.curveScale = scale; currentMotionState.distanceToDestinationOffset = Vector3.zero;//fixme(troy) - this should be non-zero, but somehow it hitches with the original code destinationOffset; currentMotionState.distanceToDestinationOffsetMagnitude = currentMotionState.distanceToDestinationOffset.magnitude; currentMotionState.freezeLocation = false; currentMotionState.isFinished = false; currentMotionState.exitFrame = exitFrame; }
public void WalkTo(Vector3 walkDestination, AnimationCurve distanceCurve, float scale) { currentMotionState = new MoveMotionStateWalk(myAnimator); currentMotionState.destination = walkDestination; currentMotionState.toDestinationNormalized = Vector3.Normalize(moveController.transform.position - currentMotionState.destination); currentMotionState.distanceToDestination = distanceCurve; currentMotionState.curveScale = scale; currentMotionState.distanceToDestinationOffset = Vector3.zero; currentMotionState.distanceToDestinationOffsetMagnitude = currentMotionState.distanceToDestinationOffset.magnitude; currentMotionState.freezeLocation = false; currentMotionState.isFinished = false; currentMotionState.exitFrame = -1.0f; }