Ejemplo n.º 1
0
    private void OnCollisionEnter(Collision other)
    {
        if (ignoreNextCollision)
        {
            return;
        }
        if (isSuperSpeedActive)
        {
            if (!other.transform.GetComponent <Goal>())
            {
                Destroy(other.transform.parent.gameObject);
            }
        }

        else
        {
            DeathPart deathPart = other.transform.GetComponent <DeathPart>();
            if (deathPart)
            {
                deathPart.HittedDeathPart();
            }
        }

        rb.velocity = Vector3.zero;
        rb.AddForce(Vector3.up * impulseForce, ForceMode.Impulse);

        ignoreNextCollision = true;
        Invoke("AllowCollision", .2f);

        perfectPass        = 0;
        isSuperSpeedActive = false;
    }
Ejemplo n.º 2
0
    private void OnCollisionEnter(Collision other)
    {
        if (ignoreNextCollision)
        {
            return;
        }
        if (isSuperSpeedActive)
        {
            if (!other.transform.GetComponent <Goal>())
            {
                Destroy(other.transform.parent.gameObject);
            }
        }
        //перезапуск уровня при падении на deathPart без форсажа
        else
        {
            DeathPart deathPart = other.transform.GetComponent <DeathPart>();
            if (deathPart)
            {
                deathPart.HittedDeathPart();
            }
        }

        rb.velocity = Vector3.zero; //убрать скорость мяча
        rb.AddForce(Vector3.up * impulseForce, ForceMode.Impulse);

        ignoreNextCollision = true;
        Invoke("AllowCollision", .2f);

        perfectPass        = 0;
        isSuperSpeedActive = false;
        Debug.Log(GameManager.singleton.score);
    }
Ejemplo n.º 3
0
    private void OnCollisionEnter(Collision other)
    {
        boundAudio.Play();

        if (ignoreNextCollision)
        {
            return;
        }
        if (isSuperSpeedActive)
        {
            if (!other.transform.GetComponent <Goal>())
            {
                /*foreach (Transform t in other.transform.parent)
                 * {
                 *  gameObject.AddComponent<TriangleExplosion>();
                 *
                 *  StartCoroutine(gameObject.GetComponent<TriangleExplosion>().SplitMesh(true));
                 *  //Destroy(other.gameObject);
                 *  Debug.Log("exploding - exploding - exploding - exploding");
                 * }*/
                Destroy(other.transform.parent.gameObject);
            }
        }
        // If super speed is not active and a death part git hit -> restart game
        else
        {
            DeathPart deathPart = other.transform.GetComponent <DeathPart>();
            if (deathPart)
            {
                deathPart.HittedDeathPart();
            }
        }

        rb.velocity = Vector3.zero; // Remove velocity to not make the ball jump higher after falling done a greater distance
        rb.AddForce(Vector3.up * impulseForce, ForceMode.Impulse);



        // Safety check
        ignoreNextCollision = true;
        Invoke("AllowCollision", .2f);

        // Handlig super speed
        perfectPass        = 0;
        isSuperSpeedActive = false;
    }
Ejemplo n.º 4
0
    private void OnCollisionEnter(Collision other)
    {
        if (_ignoreNextCollision == true)
        {
            return;
        }

        DeathPart deathPart = other.transform.GetComponent <DeathPart>();

        if (deathPart)
        {
            deathPart.HittedDeathPart();
        }


        rb.velocity = Vector3.zero;
        rb.AddForce(Vector3.up * impulseForce, ForceMode.Impulse);
        _ignoreNextCollision = true;
        Invoke("AllowCollision", .2f);
    }