public static PalShake StartShake(GameObject go, Vector3 amount, float speed, float time, bool permanent = false, float intensity = 1f) { PalShake palShake = go.GetComponent <PalShake>(); if (palShake == null || palShake.GonaDestroy) { palShake = go.AddComponent <PalShake>(); } palShake.CurShakeType = ShakeType.Shake; if (palShake.typeList.Contains(ShakeType.Shake)) { palShake.typeList.Remove(ShakeType.Shake); } palShake.typeList.Add(ShakeType.Shake); palShake.StartShake(amount, speed, time, permanent, intensity); palShake.referPos = go.transform.position; return(palShake); }
public static PalShake StartShake(GameObject go, Vector3 amount, float speed, int minSpaceTime, int maxSpaceTime, int minShakeTime, int maxShakeTime, float intensity = 1f) { PalShake palShake = go.GetComponent <PalShake>(); if (palShake == null || palShake.GonaDestroy) { palShake = go.AddComponent <PalShake>(); } palShake.CurShakeType = ShakeType.InterimShake; if (palShake.typeList.Contains(ShakeType.InterimShake)) { palShake.typeList.Remove(ShakeType.InterimShake); } palShake.typeList.Add(ShakeType.InterimShake); palShake.StartShake(amount, speed, 0f, true, intensity); palShake.referPos = go.transform.position; palShake.minSpaceTime = minSpaceTime; palShake.maxSpaceTime = maxSpaceTime; palShake.minShakeTime = minShakeTime; palShake.maxShakeTime = maxShakeTime; palShake.curSpaceTime = (float)UnityEngine.Random.Range(minShakeTime, maxShakeTime); return(palShake); }