예제 #1
0
    void DisableAndPushPlayer()
    {
        player.transform.GetComponent <PlayCtrl>().enabled = false;
        foreach (Collider2D c2d in player.transform.GetComponents <Collider2D>())
        {
            c2d.enabled = false;
        }
        foreach (Transform child in player.transform)
        {
            child.gameObject.SetActive(false);
        }
        Rigidbody2D rb = player.GetComponent <Rigidbody2D>();

        rb.velocity = Vector2.zero;
        rb.AddForce(new Vector2(-150.0f, 400f));
    }