Пример #1
0
    // Drop the pre-selected early drop pieces when the player lands on the platform
    IEnumerator EarlyBreakDrop(BreakablePiece _ebp)
    {
        yield return(new WaitForSeconds(0.04f));

        _ebp.DropPiece();

        yield break;
    }
Пример #2
0
    void DirectionalSlump(Hit hit)
    {
        gameObject.SetActive(true);

        //randomly choose an disintegration type
        switch (Rand.Range(1, 2))
        {
        case 0:
            disintegration = Type.Slump;
            break;

        case 1:
        case 2:
            disintegration = Type.Directional_Slump;
            break;

        default:
            Assert.IsTrue(false, "** Default Case Reached **");
            break;
        }

        //cycle through pieces and send them flying
        foreach (Transform child in transform)
        {
            int direction;

            //activate physics on this piece
            Rigidbody2D childRigidbody2D = child.GetComponent <Rigidbody2D>();
            childRigidbody2D.isKinematic = false;

            //start countdown towards this piece fading out
            BreakablePiece piece = child.GetComponent <BreakablePiece>();
            piece.CountDown();

            //apply disintegrations!
            switch (disintegration)
            {
            case Type.Slump:
                childRigidbody2D.AddExplosionForce(250, transform.position, 3);
                break;

            case Type.Directional_Slump:
                direction = (hit.horizontalSide == Side.Right) ? 1 : -1;
                childRigidbody2D.AddForce(new Vector3(0, -100, 0));
                childRigidbody2D.AddExplosionForce(2000, new Vector3(
                                                       transform.position.x + direction,
                                                       transform.position.y + .5f,
                                                       transform.position.z), 2
                                                   );
                break;

            default:
                Assert.IsTrue(false, "** Default Case Reached **");
                break;
            }
        }
    }
Пример #3
0
    void Explode(Hit hit)
    {
        gameObject.SetActive(true);

        //randomly choose an disintegration type
        switch (Rand.Range(1, 1))
        {
        case 0:
            disintegration = Type.Explosion;
            break;

        case 1:
            disintegration = Type.Directional_Explosion;
            break;

        case 2:
            disintegration = Type.Slump;
            break;

        case 3:
            disintegration = Type.Directional_Slump;
            break;

        case 4:
            disintegration = Type.Geyser;
            break;

        default:
            Assert.IsTrue(false, "** Default Case Reached **");
            break;
        }

        //cycle through pieces and send them flying
        foreach (Transform child in transform)
        {
            int direction;

            //activate physics on this piece
            Rigidbody2D childRigidbody2D = child.GetComponent <Rigidbody2D>();
            childRigidbody2D.isKinematic = false;

            //start countdown towards this piece fading out
            BreakablePiece piece = child.GetComponent <BreakablePiece>();
            piece.CountDown();

            //apply disintegrations!
            switch (disintegration)
            {
            case Type.Explosion:
                childRigidbody2D.AddExplosionForce(2000, transform.position, 20);
                break;

            case Type.Directional_Explosion:
                int force = (hit.horizontalSide == Side.Right) ? -50 : 50;
                childRigidbody2D.AddForce(new Vector3(force, 50, 50), ForceMode2D.Impulse);
                // params = duration, strength, vibrato, randomness.
                EventKit.Broadcast("shake camera", .7f, .4f, 20, 3f);
                break;

            case Type.Slump:
                childRigidbody2D.AddExplosionForce(250, transform.position, 3);
                break;

            case Type.Directional_Slump:
                direction = (hit.horizontalSide == Side.Right) ? 1 : -1;
                childRigidbody2D.AddForce(new Vector3(0, -100, 0));
                childRigidbody2D.AddExplosionForce(800, new Vector3(
                                                       transform.position.x + direction,
                                                       transform.position.y + .5f,
                                                       transform.position.z), 2
                                                   );
                break;

            case Type.Geyser:
                childRigidbody2D.AddForce(new Vector3(0, -75, 0), ForceMode2D.Impulse);
                break;

            default:
                Assert.IsTrue(false, "** Default Case Reached **");
                break;
            }
        }
    }