/// <summary> /// 震动 /// </summary> /// <param name="power"></param> /// <param name="duration"></param> /// <param name="dir"></param> public void startShake(int power, int duration, ShakeDir dir) { this.shakePower = power; this.shakeDirX = 0; this.shakeDirY = 0; switch (dir) { case ShakeDir.X: this.shakeDirX = 1; break; case ShakeDir.Y: this.shakeDirY = 1; break; case ShakeDir.XY: this.shakeDirX = 1; this.shakeDirY = 1; break; } this.shakeDuration = duration; this.shakeRandOffsetX = UnityEngine.Random.Range(-power, power); this.shakeRandOffsetY = UnityEngine.Random.Range(-power, power); this.shakePosX = 0; this.shakePosY = 0; }
public void Shake(float duration, int shakeTpye, float magnitude, int shakeAnimationCurveIndex, bool enableRadialBlur, Vector2 pos) { shakeDuration = duration; shake_Direction = (ShakeDir)shakeTpye; camShakeamplifier = magnitude; currentShakeIndex = (int)(shakeAnimationCurveIndex); toogleCamerShake = true; }