/// <summary> /// 指定した秒数の間、 Update のたびに実行します。 /// </summary> /// <returns>Coroutine.</returns> /// <param name="seconds">Seconds.</param> /// <param name="update">Update action.引数に経過秒数を持ちます。</param> /// <param name="finish">Finish action.</param> public static Coroutine DoOnEveryUpdate(this MonoBehaviour self, float seconds, Action <float> update, Action finish = null) { if (seconds <= 0) { if (finish != null) { finish(); } return(null); } else if (update == null) { return(self.DoAfterSeconds(seconds, finish)); } else { return(self.StartCoroutine(DoOnEveryUpdateWithSecondsCoroutine(seconds, update, finish))); } }