public void StopShake() { if (_tsp != null) { _tsp.enabled = false; _tsp = null; } }
/// <summary> /// Start the tweening operation. /// </summary> static public TweenShakePosition Begin(GameObject go, float duration, Vector3 range) { TweenShakePosition comp = UITweener.Begin <TweenShakePosition>(go, duration); comp.range = range; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } comp.style = UITweener.Style.PingPong; comp.method = UITweener.Method.BounceInOut; return(comp); }
public void StartShake(float durationTime = 1f) { Timer.AddTimer(StopShake, durationTime); _tsp = TweenShakePosition.Begin(gameObject, 0.3f, new Vector3(0, 0.1f, 0)); }