private void OnCollisionEnter(Collision collision)
 {
     StartCoroutine(ImpactEffectEnterScene());
     //audioSource.Play();
     if (isVibration)
     {
         VibrationPop.vibrateforDuration(1);
     }
 }
예제 #2
0
 public void BulletImpactOutput(float amount, float time)
 {
     this.energyTot -= bulletImpactEnergyLost;
     cameraShake.ShakeCamera(amount, time);
     BPS.hitInBulletproofMode(bulletHits);
     if (isVibrationOn)
     {
         VibrationPop.vibrateforDuration(2);
     }
 }
예제 #3
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.layer == blockLayerIndex)
     {
         Vector3 normal = collision.contacts[0].normal;
         if (canCollide || normal == collision.gameObject.transform.up /*&& !enteredCollision*/)
         {
             collidedNow = true;
             //enteredCollision = true;
             if (mode == (int)Mode.normal)
             {
                 SetEnergy();
             }
             BlockCollision(collision);
         }
         else
         {
             if (GameConst.instance.isGameOn)
             {
                 GameConst.instance.isGameOn = false;
                 this.speed = Vector3.zero;
                 uIScript.StartCoroutine(uIScript.AdvertiseReward());
                 if (isVibrationOn)
                 {
                     VibrationPop.vibrateforDuration(2);
                 }
             }
         }
     }
     else if (collision.gameObject.layer == coinLayerIndex)
     {
         int gold = PlayerPrefs.GetInt("Gold", 0);
         gold += 3;
         PlayerPrefs.SetInt("Gold", gold);
         collision.gameObject.SetActive(false);
         this.transform.position = new Vector3(this.transform.position.x, height, this.transform.position.z);
         if (isVibrationOn)
         {
             VibrationPop.vibrateforDuration(1);
         }
     }
     else if (collision.gameObject.layer == edgeLayerIndex)
     {
         if (GameConst.instance.isGameOn)
         {
             GameConst.instance.isGameOn = false;
             this.speed = Vector3.zero;
             uIScript.StartCoroutine(uIScript.AdvertiseReward());
             if (isVibrationOn)
             {
                 VibrationPop.vibrateforDuration(2);
             }
         }
     }
 }
예제 #4
0
    private void BlockCollision(Collision col)
    {
        StartCoroutine(ImpactEffect());

        uIScript.PlayHitSound();

        if (isVibrationOn)
        {
            VibrationPop.vibrateforDuration(1);
        }

        //strikeParticleScript.setStrikePSPos(col.contacts[0].point);

        // ______________ *********** Strike Calc ************** _____________

        this.transform.Rotate(new Vector3(speed.z, 0, 0), Space.Self);
    }
예제 #5
0
    private void BlockCollision(Collision col)
    {
        StartCoroutine(ImpactEffect());

        uIScript.PlayHitSound();

        //strikeParticleScript.setStrikePSPos(col.contacts[0].point);

        // ______________ *********** Strike Calc ************** _____________

        GameConst.instance.blocks[lastPassedBlock + 1].gameObject.GetComponent <BlockScript>().didCollided = true;
        strike++;

        if (!isOnStrike && strike >= 5)
        {
            ChangeToBersek();
        }
        else if (strike >= 5 && strike % 5 == 0)
        {
            bulletProofSpeed += 2f;
            pointIndex       += 1;
            strikeConstant   += 1;
            //RayCalculator();
        }
        //****** _________________________ Will Block Shift Calc _______________________ ****** //

        //GameConst.instance.shifterBlock = (Random.Range(0, GameConst.Level) < 4) ? 3 : 2;

        if (lastPassedBlock <= GameConst.instance.blocks.Length - GameConst.instance.shifterBlock - 1)
        {
            GameConst.instance.blocks[lastPassedBlock + GameConst.instance.shifterBlock].gameObject.GetComponent <BlockScript>().Shift();
        }

        this.transform.Rotate(new Vector3(speed.z, 0, 0), Space.Self);

        GameConst.instance.PointDecider(isOnStrike);
        if (isVibrationOn)
        {
            VibrationPop.vibrateforDuration(1);
        }
    }