/// <summary> /// 物件的左右抖动,循环性地修改x轴坐标,延迟和持续时间二选一 /// </summary> /// <param name="tran"></param> public void HorizontalShake(Transform tran, float delay = 0f, float duration = 0.3f) { if (delay < 0.01f) { StartCoroutine(ShakeHorizontal(tran, duration)); } else { m_readyForHorizontalShake.Enqueue(tran); TimerService.Instance().AddTimer(delay, TimerCallbackHorizontalShake); } }
/// <summary> /// 2D物体闪烁和晃动 /// </summary> /// <param name="tran"></param> public void FlashAndShake(Transform tran, float delay = 0f) { m_readyForFlashAndShake.Enqueue(tran); TimerService.Instance().AddTimer(delay, TimerCallbackFlashAndShake); }