Ejemplo n.º 1
0
    } // SceneLoadTrigger()

    IEnumerator LevelEndAnimEnded()
    {
        yield return(new WaitForSeconds(levelEndSweepTime));

        UIManager._instance.TriggerLevelSuccesed();
        MMVibrationManager.Haptic(HapticTypes.MediumImpact);
    } // LevelEndAnimEnded()
Ejemplo n.º 2
0
    public virtual void Reset(bool fromRightSideButton)
    {
        bool skipAnimation = false;

        if (!fromRightSideButton)
        {
            winType.Hide();
            StartCoroutine(winType.WhenTilesOffScreen(() => {
                Won = false;
                winType.Reset();
            }));
            skipAnimation = true;
        }
        else if (Won)
        {
            return;
        }
        MMVibrationManager.Haptic(HapticTypes.Selection);
        AcceptingInputs = true;
        collectedStars  = 0;
        goalFlag?.Reset();
        Grid?.Reset();
        Player?.SetAlive(false, skipAnimation);
        Preview.Show(false);

        TimerRunning = false;
        ElapsedTime  = 0;
        LevelInfo.SetTimer(ElapsedTime);

        SetPause(false);
    }
Ejemplo n.º 3
0
    public void ButtonSelected(NumberedLevelSelectButton button)
    {
        MMVibrationManager.Haptic(HapticTypes.Selection);
        if (LevelSelectOpen)
        {
            int buildIndex = SceneHelpers.GetBuildIndexFromLevel(WorldSelected, button.TempNumber.HasValue ? button.TempNumber.Value : button.Number);
            MusicManager.Instance.SlideVolume(0.4f, 1f);
            GameManager.Instance.LoadScene(buildIndex, null);
        }
        else
        {
            if (button.Paywalled)
            {
                Debug.Log($"TAKE ME TO THE STORE TO BUY WORLD {button.Number}!");
            }
            else
            {
                levelData = GameManager.Instance.SaveData.LevelData;
                CopyManager.OnLevelChange(button.Number);

                (this.MirroredComponent as LevelSelect).OnLevelSelectNoAction(button.MirroredComponent as NumberedLevelSelectButton);
                OnLevelSelectNoAction(button);

                // tell camera to wipe
                // world one and no world share the same style
                if (WorldSelected > 1)
                {
                    StartCoroutine(CameraWipe(0));
                }
            }
        }
    }
Ejemplo n.º 4
0
    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "DragonTooth")
        {
            _enemy.healthSliderActive.SetActive(true);
            healths -= 10 + DamageFromPlayer + SwordDamage;
            if (PlayerPrefs.GetInt("VibrationActive") == 0)
            {
                MMVibrationManager.Haptic(HapticTypes.SoftImpact, false, true, this);
            }
            blood.SetActive(true);
            BloodActive_sound.GetComponent <AudioSource>().Play();
        }

        if (healths <= 0)
        {
            KillSelf();
            fragR += 1;

            PlayerPrefs.SetFloat("fragR", fragR);
            AxeActive.GetComponent <BoxCollider>().enabled = false;
            _isDead = true;
        }

        else
        {
            Invoke("latencyBlood", 2.0f);
            Invoke("latencyCrouch", 0.01f);
        }
    }
Ejemplo n.º 5
0
 public static void Haptic(HapticTypes type)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer && false)
     {
         MMVibrationManager.Haptic(type);
     }
 }
Ejemplo n.º 6
0
        public static void Scatter <T>(T[] objectTransforms, Vector3 pos, Action <T> callback) where T : Component
        {
            if (!_instance)
            {
                Debug.LogError($"Create {nameof(ScatterObjects)} instance in scene before using! Not scattering.");
                return;
            }

            var positions = objectTransforms.Select(transform1 =>
            {
                var insideUnitCircle = (Vector3)Random.insideUnitCircle * _instance._Radius;
                insideUnitCircle     = new Vector3(insideUnitCircle.x, 0, insideUnitCircle.y) + pos;
                return(insideUnitCircle);
            }).ToArray();

            for (var index = 0; index < objectTransforms.Length; index++)
            {
                var obj      = objectTransforms[index];
                var startPos = obj.transform.position;
                var endPos   = positions[index];
                new Operation(duration: _instance._Duration, delay: _instance._DelayRange.GetRandomValueAsRange(),
                    #if SCATTER_OBJECTS_MM_HAPTIC
                              action: () =>
                {
                    MMVibrationManager.Haptic(HapticTypes.RigidImpact);
                },
                    #endif
                              updateAction: tVal =>
                {
                    obj.transform.position = Vector3.Lerp(startPos, endPos, tVal) +
                                             (Vector3.up * (_instance._HeightCurve.Evaluate(tVal) * _instance._MaxHeight));
                },
                              endAction: () => callback?.Invoke(obj)).Start();
            }
        }
Ejemplo n.º 7
0
 public void ToggleSettings()
 {
     MMVibrationManager.Haptic(HapticTypes.Selection);
     SettingsOpen = !SettingsOpen;
     SetSettingsOpen();
     GameManager.Instance.Save();
 }
Ejemplo n.º 8
0
    } // TriggerCubeCollect()

    public void TriggerGemCollectedHaptic()
    {
        if (isVibrationOn)
        {
            MMVibrationManager.Haptic(gemCollectionHapticType);
            Debug.Log("vibratedGem");
        }
    } // TriggerGemCollectedHaptic()
Ejemplo n.º 9
0
    public void OnMuteButtonToggle()
    {
        MMVibrationManager.Haptic(HapticTypes.Selection);
        bool isMuting = slider.value > 0;

        slider.value = isMuting ? 0 : 1;         // maybe should animate
        OnSliderValueChange();
    }
Ejemplo n.º 10
0
    private void _onCanBroken()
    {
        //canRenderer.sprite = ExplodedSprite;
        FoamParticleSystem.gameObject.SetActive(true);
#if UNITY_ANDROID || UNITY_IOS
        MMVibrationManager.Haptic(HapticTypes.HeavyImpact);
#endif
        _dispatchOnCanBroken();
    }
Ejemplo n.º 11
0
 public void Menu()
 {
     MMVibrationManager.Haptic(HapticTypes.Selection);
     GameManager.Instance.LoadScene(
         SceneHelpers.MenuBuildIndex,
         null,
         () => GameManager.Instance.MenuManager.OpenLevelSelect(true)
         );
 }
Ejemplo n.º 12
0
        /// <summary>
        /// When this feedback gets played
        /// </summary>
        /// <param name="position"></param>
        /// <param name="feedbacksIntensity"></param>
        protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
        {
            if (!Active)
            {
                return;
            }

            switch (HapticMethod)
            {
            case HapticMethods.AdvancedPattern:

                string iOSString = (AHAPFileForIOS == null) ? "" : AHAPFileForIOS.text;

                long[] androidPattern   = (AndroidWaveFormFile == null) ? null : AndroidWaveFormFile.WaveForm.Pattern;
                int[]  androidAmplitude = (AndroidWaveFormFile == null) ? null : AndroidWaveFormFile.WaveForm.Amplitudes;

                long[] rumblePattern     = (RumbleWaveFormFile == null) ? null : RumbleWaveFormFile.WaveForm.Pattern;
                int[]  lowFreqAmplitude  = (RumbleWaveFormFile == null) ? null : RumbleWaveFormFile.WaveForm.LowFrequencyAmplitudes;
                int[]  highFreqAmplitude = (RumbleWaveFormFile == null) ? null : RumbleWaveFormFile.WaveForm.HighFrequencyAmplitudes;

                MMVibrationManager.AdvancedHapticPattern(APVibrateIOS, iOSString, APVibrateAndroid, androidPattern, androidAmplitude,
                                                         AndroidRepeat, APVibrateAndroidIfNoSupport, APRumble,
                                                         rumblePattern, lowFreqAmplitude, highFreqAmplitude, RumbleRepeat,
                                                         OldIOSFallback, this, ControllerID);
                break;

            case HapticMethods.Continuous:
                StartCoroutine(ContinuousHapticsCoroutine());
                break;

            case HapticMethods.NativePreset:
                MMVibrationManager.Haptic(HapticType, false, AllowRumble, this, ControllerID);
                break;

            case HapticMethods.Transient:
                MMVibrationManager.TransientHaptic(TransientIntensity, TransientSharpness, AllowRumble, this, ControllerID);
                break;

            case HapticMethods.AdvancedTransient:
                MMVibrationManager.TransientHaptic(ATVibrateIOS, ATIOSIntensity, ATIOSSharpness, ATVibrateAndroid,
                                                   ATAndroidIntensity, ATAndroidSharpness, ATVibrateAndroidIfNoSupport, ATRumble,
                                                   ATRumbleIntensity, ATRumbleSharpness, ATRumbleControllerID, this);
                break;

            case HapticMethods.AdvancedContinuous:

                break;

            case HapticMethods.Stop:
                if (_continuousPlaying)
                {
                    MMVibrationManager.StopContinuousHaptic(AllowRumble);
                    _continuousPlaying = false;
                }
                break;
            }
        }
Ejemplo n.º 13
0
        protected override void CustomPlayFeedback(Vector3 position, float attenuation = 1.0f)
        {
            if (Active)
            {
#if NICEVIBRATIONS_INSTALLED
                MMVibrationManager.Haptic(HapticType);
#endif
            }
        }
Ejemplo n.º 14
0
 public void SignOut()
 {
     MMVibrationManager.Haptic(HapticTypes.Selection);
     GameManager.Instance.StoreCommunicator.SignOut((signedOut) => {
         if (signedOut)
         {
             CloseGooglePlayGamesModal();
         }
     });
 }
Ejemplo n.º 15
0
    } // SetPlayerPrefSettings()

    public void TriggerCubeCollect()
    {
        CameraController._instance.GetCollectedCubeCount();

        if (isVibrationOn)
        {
            MMVibrationManager.Haptic(cubeCollectionHapticType);
            Debug.Log("vibratedCube");
        }
    } // TriggerCubeCollect()
Ejemplo n.º 16
0
    public void VibrateHeavy()
    {
        if (vibrationActive != null && !vibrationActive.Value)
        {
            return;
        }

        MMVibrationManager.Haptic(HapticTypes.HeavyImpact);
        LogVibration(HapticTypes.HeavyImpact);
    }
Ejemplo n.º 17
0
    public void VibrateSuccess()
    {
        if (vibrationActive != null && !vibrationActive.Value)
        {
            return;
        }

        MMVibrationManager.Haptic(HapticTypes.Success);
        LogVibration(HapticTypes.Success);
    }
Ejemplo n.º 18
0
    public void OnVibrationButtonPressed()
    {
        PlayerPrefs.SetInt("VibrationEnabled", PlayerPrefs.GetInt("VibrationEnabled", 1) == 1 ? 0 : 1);
        ChangeButtonIcon(ButtonType.Vibration);

        if (PlayerPrefs.GetInt("VibrationEnabled") == 1)
        {
            MMVibrationManager.Haptic(HapticTypes.MediumImpact, false, true, this);
        }
    }
Ejemplo n.º 19
0
    public void VibrateFailure()
    {
        if (vibrationActive != null && !vibrationActive.Value)
        {
            return;
        }

        MMVibrationManager.Haptic(HapticTypes.Failure);
        LogVibration(HapticTypes.Failure);
    }
Ejemplo n.º 20
0
 public void GooglePlayGamesClicked()
 {
     MMVibrationManager.Haptic(HapticTypes.Selection);
     GameManager.Instance.StoreCommunicator.SignIn((signedIn) => {
         if (signedIn)
         {
             GooglePlayGamesModal.gameObject.SetActive(true);
         }
     });
 }
Ejemplo n.º 21
0
    public void VibrateSelectionChange()
    {
        if (vibrationActive != null && !vibrationActive.Value)
        {
            return;
        }

        MMVibrationManager.Haptic(HapticTypes.Selection);
        LogVibration(HapticTypes.Selection);
    }
            private void _Vibration(HapticTypes type, float delta, string key)
            {
                this._vibrations[key] = Time.time + delta;
                MMVibrationManager.Haptic(type);
#if UNITY_EDITOR
                if (this.ycManager.ycConfig.VibrationDebugLog)
                {
                    Debug.Log("[VIBRATION] " + type + " " + key);
                }
#endif
            }
Ejemplo n.º 23
0
    private IEnumerator PlayerReachedFireworks()
    {
        particles.gameObject.SetActive(true);
        audio.gameObject.SetActive(true);
        yield return(new WaitForSeconds(0.75f));

        while (true)
        {
            MMVibrationManager.Haptic(HapticTypes.LightImpact);
            yield return(new WaitForSeconds(UnityEngine.Random.value * 0.95f + 0.05f));
        }
    }
Ejemplo n.º 24
0
    public void ActionSelected(WinTypeAction w)
    {
        AcceptingInputs = false;

        int currentScene = SceneHelpers.GetCurrentLevelBuildIndex();

        // if we're not going to the next scene, cancel the load of the next scene
        if (w != WinTypeAction.Next)
        {
            cts.Cancel();
        }
        MMVibrationManager.Haptic(HapticTypes.Selection);
        switch (w)
        {
        case WinTypeAction.Menu:
            GameManager.Instance.LoadScene(SceneHelpers.MenuBuildIndex, StartCoroutine(winType.WhenTilesOffScreen()));
            break;

        case WinTypeAction.Reset:
            GameManager.Instance.ShowAd();
            Reset(false);
            break;

        case WinTypeAction.LevelSelect:
            GoToLevelSelect(false);
            break;

        case WinTypeAction.Next:
            // TODO: All this logic can be removed once we've guaranteed that every world has 10 levels
            int current_bi       = SceneHelpers.GetCurrentLevelBuildIndex();
            int current_bi_world = SceneHelpers.GetWorldFromBuildIndex(current_bi);
            int next_bi          = SceneHelpers.GetNextLevelBuildIndex();
            int next_bi_world    = SceneHelpers.GetWorldFromBuildIndex(next_bi);
            if (next_bi < SceneHelpers.SceneCount || (current_bi_world > 0 && current_bi_world < next_bi_world))
            {
                GameManager.Instance.ShowAd();

                // hide objects in the current level so that as the wintype animation is playing, we see the next level
                HideLevel();

                // once the tiles are offscreen, we can finally unload the level
                StartCoroutine(winType.WhenTilesOffScreen(() => {
                    GameManager.Instance.UnloadScene(currentScene, null);
                }));
            }
            else
            {
                GoToLevelSelect(false);
            }
            break;
        }
    }
Ejemplo n.º 25
0
    public void BoneTouchedGroundHandler()
    {
        if (_isVibrationEnabled && GameplayManager.CurrentEntity == EntityType.Player)
        {
            MMVibrationManager.Haptic(HapticTypes.MediumImpact, false, true, this);
        }

        if (_isSoundEnabled)
        {
            _audioSource.volume = Mathf.Clamp((_rigidbody.velocity.magnitude / 10f) + 0.4f, 0f, 1f);
            _audioSource.Play();
        }
    }
Ejemplo n.º 26
0
 public void BackSelected()
 {
     MMVibrationManager.Haptic(HapticTypes.Selection);
     // wipe
     // world one and no world share the same style
     if (WorldSelected > 1)
     {
         StartCoroutine(CameraWipe(1));
     }
     MusicManager.Instance.LoadMusicForWorldAndChangeTrack(1, 1f, 0.4f);
     (this.MirroredComponent as LevelSelect).BackAction();
     BackAction();
 }
Ejemplo n.º 27
0
 public static void StartVibration(HapticTypes vibrationType)
 {
     if (IsVibroOn)
     {
         try
         {
             MMVibrationManager.Haptic(vibrationType, false, true);
         }
         catch (Exception e)
         {
             //TODO: :ODOT\\
         }
     }
 }
Ejemplo n.º 28
0
 public virtual void PlayPauseButtonClicked()
 {
     if (!Won)
     {
         MMVibrationManager.Haptic(HapticTypes.Selection);
         if (Player.Alive)
         {
             SetPause(!Paused);
         }
         else
         {
             RespawnManager.RespawnPlayer();
             StartTimer();
         }
     }
 }
Ejemplo n.º 29
0
    public void Continue()
    {
        MMVibrationManager.Haptic(HapticTypes.Selection);
        int nextWorld = World + 1;

        if (nextWorld <= GameManager.AvailableWorlds)
        {
            GameManager.Instance.SaveData.LastPlayedWorld = nextWorld;
            MusicManager.Instance.LoadMusicForWorldAndChangeTrack(nextWorld);
            GameManager.Instance.LoadScene(SceneHelpers.GetBuildIndexFromLevel(nextWorld, 1));
        }
        else
        {
            GameManager.Instance.LoadScene(SceneHelpers.SceneCount - 1);
        }
    }
 void Vib(LocalizedVibrationType type)
 {
     if(type == LocalizedVibrationType.Heavy)
     {
         MMVibrationManager.Haptic(HapticTypes.MediumImpact);
     }
     else if(type == LocalizedVibrationType.Light)
     {
         MMVibrationManager.Haptic(HapticTypes.Selection);
     }
     else if(type == LocalizedVibrationType.Off)
     {
         MMVibrationManager.Haptic(HapticTypes.None);
     }
     else { return; }
 }