// Update is called once per frame void FixedUpdate() { switch (AnimState) { case AnimationState.Idle: break; case AnimationState.PulseAttack: bool attackComplete = attackCurve.UpdateCurve(Time.deltaTime); gameObject.transform.localScale = Vector3.Lerp(defaultScale, defaultScale * PulseScaleProportion, attackCurve.animCurveCounter); if (attackComplete) { AnimState = AnimationState.PulseRelease; } break; case AnimationState.PulseRelease: bool releaseComplete = releaseCurve.UpdateCurve(Time.deltaTime); gameObject.transform.localScale = Vector3.Lerp(defaultScale * PulseScaleProportion, defaultScale, releaseCurve.animCurveCounter); if (releaseComplete) { AnimState = AnimationState.Idle; } break; } }
// Update is called once per frame void Update() { switch (animState) { case AnimationState.Attack: bool attackCurveComplete = animCurveAttack.UpdateCurve(Time.deltaTime); float attackScale = Mathf.Lerp(1.0f, pulseScale, animCurveAttack.animCurveCounter); transform.localScale = attackScale * startScale; if (attackCurveComplete) { animState = AnimationState.Release; } break; case AnimationState.Release: bool releaseCurveComplete = animCurveRelease.UpdateCurve(Time.deltaTime); float releaseScale = Mathf.Lerp(pulseScale, 1.0f, animCurveRelease.animCurveCounter); transform.localScale = releaseScale * startScale; if (releaseCurveComplete) { if (loop) { animState = AnimationState.Attack; } else { animState = AnimationState.Idle; } } break; default: break; } }
public bool Update(float deltaTime) { bool curveComplete = animCurve.UpdateCurve(deltaTime); value = Mathf.Lerp(start, target, animCurve.animCurveCounter); if (curveComplete) { value = target; } return(curveComplete); }
public bool Update(float deltaTime) { bool curveComplete = animCurve.UpdateCurve(deltaTime); foreach (InterpedValue interpedValue in interpedValues) { if (curveComplete) { interpedValue.value = interpedValue.target; } else { interpedValue.value = Mathf.Lerp(interpedValue.start, interpedValue.target, animCurve.animCurveCounter); } } return(curveComplete); }
void FixedUpdate() { if (animationState == AnimationState.Moving) { animCurve.UpdateCurve(Time.deltaTime); float angle = angleLeftToRotate * animCurve.portionThisFrame; transform.RotateAround(arcPoint, rotationAxis, angle); angleLeftToRotate -= angle; if (animCurve.animLinearCounter >= 1.0f) { animationState = AnimationState.Stationary; transform.position = targetPos; transform.eulerAngles = targetEuler; } } }