예제 #1
0
    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();
            }
        }
    }
예제 #2
0
    public static void Cancel()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        AndroidVibrator.Cancel();
#else
        // Cancel Vibration
#endif
    }
예제 #3
0
    public static void Vibrate(float seconds)
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        AndroidVibrator.Vibrate((long)(seconds * 1000));
#else
        // ios failed
        // Handheld.Vibrate();
#endif
    }