Exemple #1
0
    // Use this for initialization
    void Start()
    {
        if (boosterForce <= 0)
        {
            throw new UnityException("Rocket was initialized without a boosterForce. Are you missing a Rocket.Launch call?");
        }

        body = GetComponent <Rigidbody2D>();
        GravityGlobal.AddGravityObject(gameObject);
    }
Exemple #2
0
    /// <summary>
    /// Creates a new instances of a sphere and scales it to the current shatter ratio.
    /// </summary>
    /// <returns>The newly created sphere.</returns>
    private GameObject InstantiateScaledBall()
    {
        var newPiece = Instantiate(subPiece);

        newPiece.transform.localScale = transform.localScale * shatterRatio;
        newPiece.GetComponent <Rigidbody2D>().mass = NewPieceMass;
        newPiece.transform.parent = piecesContainer;
        GravityGlobal.AddGravityObject(newPiece);
        totalNumberOfCreatedSubPieces++;
        return(newPiece);
    }