private void OnCollectedObject(bool isCollectable) { #if UNITY_ANDROID && !UNITY_EDITOR AndroidVibrator.Vibrate(50); #endif if (isCollectable) { collectedCount++; OnLevelProgress?.Invoke(levelPhase, (float)collectedCount / neededCollectableCountToPassChapter); } else { gameManager.OnLevelFailed(); return; } if (collectedCount == neededCollectableCountToPassChapter) { if (levelPhase == LevelPhase.FirstChapter) { FirstChapterCompleted(); } else { SecondChapterCompleted(); } } }
public static void Vibrate(float seconds) { #if UNITY_ANDROID && !UNITY_EDITOR AndroidVibrator.Vibrate((long)(seconds * 1000)); #else // ios failed // Handheld.Vibrate(); #endif }