/// <summary>
    /// Enables a level at bottom
    /// </summary>
    public void EnableLevel()
    {
        AndroidVibration.Vibrate(50);
        _lowestActiveLevel -= 1;
        if (_lowestActiveLevel < 0)
        {
            return;
        }

        if (_lowestActiveLevel - 1 >= 0)
        {
            _tower[_lowestActiveLevel - 1].ForEach((BlockScript block) => block.SetColliderState(true));
        }

        foreach (BlockScript block in _tower[_lowestActiveLevel])
        {
            block.transform.position -= Vector3.up * _minLevelDist;
            block.SetBlockState(true);
        }

        Vector3 towerTopPos = _gameLevel.TowerSetting.TowerCenter + Vector3.up * _gameLevel.TowerSetting.BlockHeight * _tower.Count;

        _towerLevelChangedCallback(towerTopPos);

        if (_lowestActiveLevel == _gameLevel.specialBlockLevel)
        {
            Debug.Log("special");
            StartGemBlockSequence();
        }
    }
Example #2
0
    public void Vibrate(E_FeedBackType type)
    {
        if (s_Vibrate == false)
        {
            return;
        }

                #if UNITY_EDITOR
        Debug.Log("Vibrate");
#elif UNITY_IOS
        if (Device.generation == DeviceGeneration.iPhone7 ||
            Device.generation == DeviceGeneration.iPhone7Plus ||
            Device.generation == DeviceGeneration.iPhone8 ||
            Device.generation == DeviceGeneration.iPhone8Plus ||
            Device.generation == DeviceGeneration.iPhoneX ||
            Device.generation.ToString() == "iPhoneUnknown")
        {
            iOSHapticFeedback.Instance.Trigger((iOSHapticFeedback.iOSFeedbackType)type);
        }
        else if (type == E_FeedBackType.ImpactHeavy || type == E_FeedBackType.Failure)
        {
            Handheld.Vibrate();
        }

        //iOSHapticFeedback.Instance.Trigger
#elif UNITY_ANDROID
        AndroidVibration.Vibrate(androidForces[type]);
#endif
    }
    private void OnCollisionEnter(Collision collision)
    {
        if (_isObjectHit)
        {
            return;
        }
        BlockScript block = collision.gameObject.GetComponent <BlockScript>();

        if (block != null && block.CompareColor(_renderer.sharedMaterial))
        {
            AndroidVibration.Vibrate(20);
            block.Hit();
            gameObject.SetActive(false);
        }
        _isObjectHit = true;
    }