Example #1
0
    public void ReInitializeBalance()
    {
        CubeController[] c = actualPuzzle.transform.GetComponentsInChildren <CubeController>();
        foreach (CubeController cube in c)
        {
            cube.ReturnStartPos();
            cube.GetComponent <Rigidbody>().velocity = Vector3.zero;
            cube.transform.rotation = Quaternion.identity;
            cube.GetComponent <Rigidbody>().maxAngularVelocity = 0;
            cube.GetComponent <Rigidbody>().useGravity         = false;
        }
        BalanceController b = actualPuzzle.GetComponentInChildren <BalanceController> ();

        b.gameObject.transform.localRotation          = Quaternion.identity;
        b.GetComponent <Rigidbody> ().velocity        = Vector3.zero;
        b.GetComponent <Rigidbody> ().angularVelocity = Vector3.zero;
    }