public void AnimateTurn(Vector3 endPosition, float speed, TypeAnimation typeAnim, bool destroy = false) { float distance = (transform.position - endPosition).magnitude; float time = distance / speed; time = Mathf.Min(time, 1.5f); switch (typeAnim) { case TypeAnimation.Step: iTween.MoveTo(gameObject, iTween.Hash("position", endPosition, "time", time, "easetype", iTween.EaseType.easeInOutBack)); break; case TypeAnimation.Hit: iTween.MoveTo(gameObject, iTween.Hash("position", endPosition, "time", time, "delay", 0.4f, "easetype", iTween.EaseType.easeOutBack)); break; case TypeAnimation.Defeat: iTween.ShakePosition(gameObject, iTween.Hash("x", 0.1, "time", 0.5f, "easetype", iTween.EaseType.easeInOutBack)); iTween.MoveTo(gameObject, iTween.Hash("position", endPosition, "time", time, "delay", 0.5f, "easetype", iTween.EaseType.easeInBack)); break; case TypeAnimation.Back: if (destroy) { iTween.MoveTo(gameObject, iTween.Hash("position", endPosition, "time", speed, "easetype", iTween.EaseType.easeInSine, "oncomplete", "Delete", "oncompletetarget", gameObject, "oncompleteparams", time)); } else { iTween.MoveTo(gameObject, iTween.Hash("position", endPosition, "time", speed, "easetype", iTween.EaseType.easeInSine)); } break; } }
public static AnimatorBundle Create(TypeAnimation typeAnimation, View view, IInterpolator interpolator, float from, float to) { var animatorBundle = new AnimatorBundle(typeAnimation); animatorBundle.mView = view; animatorBundle.mFromValue = from; animatorBundle.mDelta = to - from; animatorBundle.mInterpolator = interpolator; return(animatorBundle); }
internal AnimatorBundle(TypeAnimation typeAnimation) { mTypeAnimation = typeAnimation; }
public static AnimatorBundle Create(TypeAnimation typeAnimation, View view, IInterpolator interpolator, float from, float to) { var animatorBundle = new AnimatorBundle(typeAnimation); animatorBundle.mView = view; animatorBundle.mFromValue = from; animatorBundle.mDelta = to - from; animatorBundle.mInterpolator = interpolator; return animatorBundle; }