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