IEnumerator Scale()
    {
        float timer = 0;


        while (true) // this could also be a condition indicating "alive or dead"
        {
            // we scale all axis, so they will have the same value,
            // so we can work with a float instead of comparing vectors
            while (maxSize > m_player.transform.localScale.x)
            {
                timer += Time.deltaTime;
                m_player.transform.localScale += new Vector3(1, 1, 1) * Time.deltaTime * growFactor;
                Vibration.VibratePeek();
                yield return(null);
            }
            // reset the timer


            yield return(new WaitForSeconds(waitTime));

            timer = 0;
            while (1 < transform.localScale.x)
            {
                timer += Time.deltaTime;
                transform.localScale -= new Vector3(1, 1, 1) * Time.deltaTime * growFactor;
                Vibration.VibratePeek();
                yield return(null);
            }

            timer = 0;
            yield return(new WaitForSeconds(waitTime));
        }
    }
Beispiel #2
0
        public void TakeDamage(float damage)
        {
            heart.Damage(damage);


            Vector3 velocity = Random.insideUnitSphere * impulseMagnitude;

            // kill the z-channel to avoid going below the 2d plane
            // where characters are spawned
            velocity.z = 0;
            // higher intensity if the player dies
            if (heart.IsDead)
            {
                // strong vibrate when player dies
                Vibration.VibratePop();
                velocity *= 3;
            }
            else
            {
                // vibrate when player recieves damage
                Vibration.VibratePeek();
            }
            // create camera shake effect
            impulseSource.GenerateImpulse(velocity);
        }
 public void AddApplePoint()
 {
     _applePoints++;
     Vibration.VibratePeek();
     RefreshProgressData();
     UIController.instance.RefreshData(_applePoints, _numOfPassedLevels, _numOfKnivesToSpawn, _numOfThorwKnives);
 }
    private void OnCollisionEnter2D(Collision2D collision)
    { //События происходящие если нож попал в бревно
        if (collision.gameObject.CompareTag("Log"))
        {
            if (vibrationOption >= 1)
            {
                Vibration.VibratePop();                         //включаем вибрацию если нужно
            }
            PlayerPrefs.SetInt("HitCount", GameManager.manager.hitCount);
            PlayerPrefs.SetInt("Stage", GameManager.manager.stage);
            PlayerPrefs.SetInt("Apple", GameManager.manager.apple);
            GameManager.manager.hitCount    += 1;                                                                   //увеличиваем счетчик попаданий
            GameManager.manager.currentIcon -= 1;                                                                   //передвигает позицию текущей иконки доступного ножа
            GameManager.manager.ChangeIconState();                                                                  //изменяе состояние иконок доступных ножей
            ContactPoint2D contact = collision.contacts[0];                                                         //Получаем первую точку контакта ножа с бревном
            Instantiate(Knife, contact.point, Quaternion.identity, collision.gameObject.transform);                 // в этой точке создаем нож
            Instantiate(splintersParticles, contact.point - new Vector2(0f, 0.2f), Quaternion.Euler(180f, 0f, 0f)); // чуть ниже этой точки создаем партиклы стружки из дерева
            SoundManager.singltone.sounds[0].Play();                                                                //включаем звук попадания ножа
            Destroy(gameObject);
        }

        if (collision.gameObject.CompareTag("OldKnife"))
        {                                    //События происходящие при попадании в другой нож
            InGameMenu.singltone.StopGame(); //Включаем меню в игре
            if (vibrationOption == 1)
            {
                Vibration.VibratePeek();                                               //включаем вибрацию если она разрешена
            }
            Instantiate(prefabAnimationFail, transform.position, Quaternion.identity); //создаем анимированный нож который вращаясь улетает в даль
            SoundManager.singltone.sounds[1].Play();                                   //Проигрываем звук попадания
            Destroy(gameObject);
        }
    }
Beispiel #5
0
    public static void MediumVibrate()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        Vibration.Vibrate(100);
#endif
#if UNITY_IOS && !UNITY_EDITOR
        Vibration.VibratePeek();
#endif
    }
Beispiel #6
0
    //Peek vibration: strong boom (only available with the haptic engine: iPhone 6s minimum)
    public void TapPeekVibrate()
    {
        if (IsHapticFeedbackEnabled())
        {
#if UNITY_IOS && !UNITY_EDITOR
            Vibration.VibratePeek();
#endif
        }
    }
Beispiel #7
0
    private void BigVibrate()
    {
        if (!Application.isEditor)
        {
#if UNITY_ANDROID
            Vibration.Vibrate(500);
#elif UNITY_IOS
            Vibration.VibratePeek();
#endif
        }
    }
Beispiel #8
0
    private void OnTriggerEnter(Collider other)
    {
        switch (other.CompareTag("Player"))
        {
        case true:
            m_AI.m_ShouldFollow = b_canFollow;
            m_boidsAnimator.SetBool("Run", b_canFollow);
            Vibration.VibratePeek();
            break;

        case false:
            break;
        }
    }
Beispiel #9
0
    private void OnCollisionEnter(Collision collision)
    {
        switch (collision.collider.CompareTag("Player") && m_mergeZone)
        {
        case true:
            m_gameManager.maxSize   += m_maxSize;
            m_gameManager.growFactor = m_growthRate;
            m_gameManager.Merge();
            Vibration.VibratePeek();
            Destroy(gameObject);
            break;

        case false:
            break;
        }
    }
Beispiel #10
0
        public void VibrateStrong()
        {
#if !UNITY_EDITOR
#if UNITY_ANDROID
            Vibration.Vibrate(AndroidStrongDuration);
#elif UNITY_IOS
            if (!iosHasOldVibrator)
            {
                Vibration.VibratePeek();
            }
            else if (IosOldVibratorReplacementEnabled)
            {
                UnityEngine.Debug.Log("iOS OldVibration replacement.");
                Vibration.VibrateOldShort();
            }
#endif
#endif
        }
Beispiel #11
0
    private void Update()
    {
        if (anchorProperty.GetTransformProperty().Item3)
        {
            _distance = Vector3.Distance(transform.position, anchorProperty.GetTransformProperty().Item1);
            if (_distance >= 0.01f)
            {
                var newPos = Vector3.Lerp(transform.position, anchorProperty.GetTransformProperty().Item1, 35f * Time.deltaTime);
                transform.position = newPos;
                transform.rotation = anchorProperty.GetTransformProperty().Item2;
                //Debug.Log("corutin");
            }
            else
            {
                anchorProperty.SetTransformProperty(false);
                SvedObject.GetHitObject().gameObject.SetActive(false);


                _scoreManager.CalculateScore(anchorProperty.GetAnchorType(), anchorProperty.GetCurrentSelectedPiece());

                gameObject.tag = _untag;
                gameObject.transform.parent = _holder.transform;
                _undoBooster.AddToHistory(gameObject, jewelleryPos.GetValue(), SvedObject.GetHitObject().gameObject);
                this.enabled = false;
                Vibration.VibratePeek();
            }
        }
        else
        {
            _distance = Vector3.Distance(transform.position, jewelleryPos.GetValue());
            if (_distance > 0.1f)
            {
                var newPos = Vector3.Lerp(transform.position, jewelleryPos.GetValue(), 6f * Time.deltaTime);
                transform.position = newPos;
                //Debug.Log("corutin");
            }
            else
            {
                _rb.isKinematic = false;
                this.enabled    = false;
            }
        }
    }
Beispiel #12
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Fish"))
        {
            Vibration.VibratePeek();

            var fishObj = other.gameObject;
            fishObj.transform.parent = transform;

            var fish = fishObj.GetComponent <Fish1>();
            fish.ShowText(_fishManager.transform);
            _caughtFish.Add(fish);
            ++_currentStrength;
            _UI.UpdateCurrentFish(_currentStrength);

            _fishManager.RemoveFish(fish);
            fish.CatchFish(transform.GetChild(0));

            other.enabled = false;
        }
    }
    public void OnSliceFinished(BzSliceTryResult result)
    {
        if (!result.sliced)
        {
            return;
        }

        piecesCutCount++;
        // Debug.Log("pieces Cut: " + piecesCutCount);

        Gameplay_References._instance._soundManager.PlaySoundEffectOneShot(0);
        Gameplay_References._instance._uiManager.SetLevelFillerValue(piecesCutCount / TotalPiecesCount);
        PlayExclamationText();
        Gameplay_References._instance._meshSlicesTracker.GetCutSlices(result.outObjectPos, result.outObjectNeg);

        if (GameConstants.isVibrationEnabled)
        {
            // Debug.Log ("vibrating");
            Vibration.VibratePeek();
        }
    }
Beispiel #14
0
 public void VibratePeek()
 {
     Vibration.VibratePeek();
 }
    IEnumerator Fight()
    {
        isFighting = true;

        switch (m_currentTotal == m_TargetTotal)
        {
        case true:
            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1.2f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1.2f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1.2f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1.2f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1.2f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1.2f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1.2f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            isFighting = false;
            switch (!isFighting)
            {
            case true:
                Win();
                break;

            case false:
                break;
            }
            break;

        case false:
            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_bossAnimator.SetTrigger("Fight");
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            m_playerAnimator.SetTrigger("Hit");
            Vibration.VibratePeek();
            yield return(new WaitForSeconds(1f));

            m_player.transform.LookAt(m_boss.position);
            m_boss.transform.LookAt(m_player.position);
            isFighting = false;
            switch (!isFighting)
            {
            case true:
                Lose();
                break;

            case false:
                break;
            }
            break;
        }
    }
 public void TapPeekVibrate()
 {
     Vibration.VibratePeek();
 }
    public void TapPeekVibrate()
    {
#if UNITY_IOS && !UNITY_EDITOR
        Vibration.VibratePeek();
#endif
    }