Exemple #1
0
    public void Button_EDIT()
    {
        if (MainObjectToEdit.GetComponent <MeshCollider>())
        {
            MainObjectToEdit.gameObject.GetComponent <MeshCollider> ().convex = true;
        }

        if (MainObjectToEdit.GetComponent <Rigidbody>())
        {
            MainObjectToEdit.GetComponent <Rigidbody>().useGravity  = false;
            MainObjectToEdit.GetComponent <Rigidbody>().isKinematic = true;
        }

        foreach (GameObject OnePoint in GameObject.FindGameObjectsWithTag("Point"))
        {
            OnePoint.GetComponent <MeshRenderer>().enabled = true;
            OnePoint.GetComponent <Collider>().enabled     = true;
        }


        MainObjectToEdit.transform.position = MyFirstPos;
        MainObjectToEdit.transform.rotation = MyFirstRot;

        UI_InEdit.SetActive(true);
        UI_InTest.SetActive(false);
    }
Exemple #2
0
    public void Button_TEST()
    {
        if (AddCollider)
        {
            if (!MainObjectToEdit.GetComponent <MeshCollider>())
            {
                MainObjectToEdit.AddComponent <MeshCollider>();
            }
            if (MainObjectToEdit.GetComponent <MeshCollider>())
            {
                MainObjectToEdit.gameObject.GetComponent <MeshCollider> ().convex = true;
            }
        }
        if (AddRigidbody)
        {
            if (!MainObjectToEdit.GetComponent <Rigidbody>())
            {
                MainObjectToEdit.AddComponent <Rigidbody>();
            }
            if (MainObjectToEdit.GetComponent <Rigidbody>())
            {
                MainObjectToEdit.GetComponent <Rigidbody>().useGravity  = true;
                MainObjectToEdit.GetComponent <Rigidbody>().isKinematic = false;
            }
        }

        foreach (GameObject OnePoint in GameObject.FindGameObjectsWithTag("Point"))
        {
            OnePoint.GetComponent <MeshRenderer>().enabled = false;
            OnePoint.GetComponent <Collider>().enabled     = false;
        }

        UI_InEdit.SetActive(false);
        UI_InTest.SetActive(true);
    }