Beispiel #1
0
    public void test()
    {
        GameObject   trex   = GameObject.Find("trex_ori");
        ObjectScript script = (ObjectScript)trex.GetComponent("ObjectScript");

        script.clone();

        GameObject   clone       = GameObject.Find("trex_ori1");
        GameObject   tafel       = GameObject.Find("tafel");
        ObjectScript cloneScript = (ObjectScript)clone.GetComponent("ObjectScript");
    }
    // The object will be cloned and placed onto selectedObject
    public void End()
    {
        if (!isActive)
        {
            return;
        }

        GameObject clone = null;

        if (currentPossibleStackedObject)
        {
            Vector3    temp  = currentPossibleStackedObject.transform.position;
            Quaternion temp2 = currentPossibleStackedObject.transform.rotation;

            ObjectScript oscript = (ObjectScript)currentPossibleStackedObject.GetComponent("ObjectScript");
            string       name_   = (string)(oscript.clone());
            clone = GameObject.Find(name_);
            clone.transform.position = temp;
            clone.transform.rotation = temp2;

            if (gridModus)
            {
                scriptOfSelectedObject.addChildInGrid(clone, currColInGrid, currRowInGrid);
            }
            else
            {
                scriptOfSelectedObject.addChild(clone, currLeftRightOnObject, currTopDownOnObject);
            }

            temp.y = -50f;
            currentPossibleStackedObject.transform.position = temp;
        }

        foreach (GameObject obj in lines)
        {
            Destroy(obj);
        }
        lines.Clear();

        ((SmoothCameraScript)GetComponent("SmoothCameraScript")).returnFromTopview();
        isActive = false;
    }