public void createBigbox()
    {
        if (!partCreated[3])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(90, 0, 0);
            GameObject newBigbox      = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[3], pos, fuseToRotation)));

            Transform bigboxLongboxAttach      = newBigbox.transform.FindChild("bigbox_longbox_attach");
            Transform bigboxSmallboxBlueAttach = newBigbox.transform.FindChild("bigbox_smallbox_blue_attach");

            FuseAttributes fuseAtts = bigboxFuses();

            bigboxLongboxAttach.gameObject.AddComponent <FuseBehavior>();
            bigboxLongboxAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            bigboxLongboxAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Bigbox"));

            bigboxSmallboxBlueAttach.gameObject.AddComponent <FuseBehavior>();
            bigboxSmallboxBlueAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            bigboxSmallboxBlueAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Bigbox"));

            instantiated[3] = newBigbox;
            partCreated[3]  = true;
            selectionManager.newPartCreated("tutorial2_bigboxPrefab(Clone)");

            enableManipulationButtons(newBigbox);
        }
    }
Пример #2
0
    public void createWaluigi()
    {
        if (!partCreated[2])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = new Quaternion();
            GameObject newWaluigi     = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[2], pos, fuseToRotation)));

            Transform waluigiUprightLAttach = newWaluigi.transform.Find("waluigi_upright_L_attach");

            //fixes off center rotation problem
            //strutTopBodyAttach.transform.localPosition = new Vector3(0, 0, 0);
            //strutTopGeneratorAttach.transform.localPosition = new Vector3(0.08f, 0, -0.72f);
            //strutTopPointyAttach.transform.localPosition = new Vector3(0, 0, 0);

            FuseAttributes fuseAtts = waluigiFuses();

            waluigiUprightLAttach.gameObject.AddComponent <FuseBehavior>();
            waluigiUprightLAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            waluigiUprightLAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Waluigi"));


            instantiated[2] = newWaluigi;
            partCreated[2]  = true;
            selectionManager.newPartCreated("waluigiPrefab(Clone)");

            enableManipulationButtons(newWaluigi);
        }
    }
Пример #3
0
    public void createUprightRect()
    {
        if (!partCreated[4])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = new Quaternion();
            GameObject newUprightRect = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[4], pos, fuseToRotation)));

            Transform uprightRectWalkingPantsAttach = newUprightRect.transform.Find("upright_rect_walking_pants_attach");

            //fixes off center rotation problem
            //bodyChild.transform.localPosition = new Vector3(0, 0, 0);
            //pointyStrutTopAttach.transform.localPosition = new Vector3(0, -1.35f, 0);
            //dec1.transform.localPosition = new Vector3(0.05f, 0, -1.52f);
            //dec2.transform.localPosition = new Vector3(0.7f, 0, -1.85f);

            FuseAttributes fuseAtts = uprightRectFuses();

            uprightRectWalkingPantsAttach.gameObject.AddComponent <FuseBehavior>();
            uprightRectWalkingPantsAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            uprightRectWalkingPantsAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("UprightRect"));

            instantiated[4] = newUprightRect;
            partCreated[4]  = true;
            selectionManager.newPartCreated("upright_rectPrefab(Clone)");

            enableManipulationButtons(newUprightRect);
        }
    }
    public void createCone()
    {
        if (!partCreated[2])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 90, 90);
            GameObject newCone        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[2], pos, fuseToRotation)));

            Transform coneBoxAttach = newCone.transform.FindChild("cone_box_attach");

            FuseAttributes fuseAtts = coneFuses();

            coneBoxAttach.gameObject.AddComponent <FuseBehavior>();
            coneBoxAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            coneBoxAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Cone"));


            instantiated[2] = newCone;
            partCreated[2]  = true;
            selectionManager.newPartCreated("tutorial1_conePrefab(Clone)");

            enableManipulationButtons(newCone);
        }
    }
Пример #5
0
    public void createUprightT()
    {
        if (!partCreated[1])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = new Quaternion();
            GameObject newUprightT    = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[1], pos, fuseToRotation)));

            Transform uprightTdanglyTAttach = newUprightT.transform.Find("upright_T_dangly_T_attach");

            //fixes off center rotation problem
            //uprightTdanglyTAttach.transform.localPosition = new Vector3(0, 0, 0);

            FuseAttributes fuseAtts = uprightTFuses();

            uprightTdanglyTAttach.gameObject.AddComponent <FuseBehavior>();
            uprightTdanglyTAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            uprightTdanglyTAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("UprightT"));



            instantiated[1] = newUprightT;
            partCreated[1]  = true;
            selectionManager.newPartCreated("uprightTPrefab(Clone)");

            enableManipulationButtons(newUprightT);
        }
    }
Пример #6
0
    public void createScalene()
    {
        if (!partCreated[10])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 90, 0);
            GameObject newScalene     = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[10], pos, fuseToRotation)));

            Transform scaleneLeftTriBackAttach = newScalene.transform.Find("scalene_left_tri_back_attach");
            Transform scaleneLeftTriSideAttach = newScalene.transform.Find("scalene_left_tri_side_attach");

            FuseAttributes fuseAtts = scaleneFuses();

            scaleneLeftTriBackAttach.gameObject.AddComponent <FuseBehavior>();
            scaleneLeftTriBackAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            scaleneLeftTriBackAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Scalene"));

            scaleneLeftTriSideAttach.gameObject.AddComponent <FuseBehavior>();
            scaleneLeftTriSideAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            scaleneLeftTriSideAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Scalene"));

            instantiated[10] = newScalene;
            partCreated[10]  = true;
            selectionManager.newPartCreated("scalenePrefab(Clone)");

            enableManipulationButtons(newScalene);
        }
    }
Пример #7
0
    public void createRightTriChunk()
    {
        if (!partCreated[9])
        {
            clearPartsCreated();
            Vector3    pos              = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation   = Quaternion.Euler(0, 90, 0);
            GameObject newRightTriChunk = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[9], pos, fuseToRotation)));

            Transform rightTriChunkRightTriBackAttach  = newRightTriChunk.transform.Find("right_tri_chunk_right_tri_back_attach");
            Transform rightTriChunkRightTriSideAttach  = newRightTriChunk.transform.Find("right_tri_chunk_right_tri_side_attach");
            Transform rightTriChunkRightTriAngleAttach = newRightTriChunk.transform.Find("right_tri_chunk_right_tri_angle_attach");

            FuseAttributes fuseAtts = rightTriChunkFuses();

            rightTriChunkRightTriBackAttach.gameObject.AddComponent <FuseBehavior>();
            rightTriChunkRightTriBackAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            rightTriChunkRightTriBackAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("RightTriChunk"));

            rightTriChunkRightTriSideAttach.gameObject.AddComponent <FuseBehavior>();
            rightTriChunkRightTriSideAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            rightTriChunkRightTriSideAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("RightTriChunk"));

            rightTriChunkRightTriAngleAttach.gameObject.AddComponent <FuseBehavior>();
            rightTriChunkRightTriAngleAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            rightTriChunkRightTriAngleAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("RightTriChunk"));

            instantiated[9] = newRightTriChunk;
            partCreated[9]  = true;
            selectionManager.newPartCreated("right_tri_chunkPrefab(Clone)");

            enableManipulationButtons(newRightTriChunk);
        }
    }
Пример #8
0
    public void createBlueTri()
    {
        if (!partCreated[8])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 90, 0);
            GameObject newBlueTri     = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[8], pos, fuseToRotation)));

            Transform blueTriCenterTriBackAttach = newBlueTri.transform.Find("blue_tri_center_tri_back_attach");
            Transform blueTriCenterTriSideAttach = newBlueTri.transform.Find("blue_tri_center_tri_side_attach");

            FuseAttributes fuseAtts = blueTriFuses();

            blueTriCenterTriBackAttach.gameObject.AddComponent <FuseBehavior>();
            blueTriCenterTriBackAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            blueTriCenterTriBackAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("BlueTri"));

            blueTriCenterTriSideAttach.gameObject.AddComponent <FuseBehavior>();
            blueTriCenterTriSideAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            blueTriCenterTriSideAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("BlueTri"));

            instantiated[8] = newBlueTri;
            partCreated[8]  = true;
            selectionManager.newPartCreated("blue_triPrefab(Clone)");

            enableManipulationButtons(newBlueTri);
        }
    }
Пример #9
0
    public void createB1p3()
    {
        if (!partCreated[2])
        {
            clearPartsCreated();
            Vector3    pos            = offscreenCreateLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 90, 270);
            GameObject newB1p3        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[2], pos, fuseToRotation)));
            StartCoroutine(moveToStartingPosition(newB1p3)); // this creates the zooming up from the ground effect

            Transform b1p3        = newB1p3.transform.Find("b1p3");
            Transform b1p3_bb1_a1 = newB1p3.transform.Find("b1p3_bb1_a1");
            b1p3.GetComponent <Tooltip>().enabled        = true;
            b1p3_bb1_a1.GetComponent <Tooltip>().enabled = true;

            FuseAttributes fuseAtts = b1p3Fuses();

            b1p3_bb1_a1.gameObject.AddComponent <FuseBehavior>();
            b1p3_bb1_a1.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            b1p3_bb1_a1.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("B1p3"));

            b1p3_bb1_a1.gameObject.AddComponent <FaceSelector>();
            b1p3_bb1_a1.gameObject.GetComponent <FaceSelector>().setSelectPartScript(GameObject.Find("EventSystem").GetComponent <SelectPart>());
            b1p3_bb1_a1.gameObject.GetComponent <FaceSelector>().setFuseButton(GameObject.Find("FuseButton").GetComponent <Button>());
            b1p3_bb1_a1.gameObject.GetComponent <FaceSelector>().selectedNormal = Vector3.down;

            instantiated[2]             = newB1p3;
            partCreated[2]              = true;
            partButtons[2].interactable = false;

            selectionManager.newPartCreated("b1p3Prefab(Clone)");
        }
    }
Пример #10
0
    public void createThrowingArm()
    {
        if (!partCreated[1])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 270, 0);
            GameObject newThrowingArm = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[1], pos, fuseToRotation)));

            Transform throwingArmAxleLeftAttach   = newThrowingArm.transform.FindChild("throwing_arm_axle_left_attach");
            Transform throwingArmAxleRightAttach  = newThrowingArm.transform.FindChild("throwing_arm_axle_right_attach");
            Transform throwingArmAxleBottomAttach = newThrowingArm.transform.FindChild("throwing_arm_axle_bottom_attach");

            FuseAttributes fuseAtts = throwingArmFuses();

            throwingArmAxleLeftAttach.gameObject.AddComponent <FuseBehavior>();
            throwingArmAxleLeftAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            throwingArmAxleLeftAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("ThrowingArm"));

            throwingArmAxleRightAttach.gameObject.AddComponent <FuseBehavior>();
            throwingArmAxleRightAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            throwingArmAxleRightAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("ThrowingArm"));

            throwingArmAxleBottomAttach.gameObject.AddComponent <FuseBehavior>();
            throwingArmAxleBottomAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            throwingArmAxleBottomAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("ThrowingArm"));

            instantiated[1] = newThrowingArm;
            partCreated[1]  = true;
            selectionManager.newPartCreated("throwing_arm_completePrefab(Clone)");

            enableManipulationButtons(newThrowingArm);
        }
    }
Пример #11
0
    public void createLeftTri()
    {
        if (!partCreated[4])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(90, 90, 0);
            GameObject newLeftTri     = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[4], pos, fuseToRotation)));

            Transform leftTriRingLargePartAttach = newLeftTri.transform.Find("left_tri_ring_large_part_attach");
            Transform leftTriScaleneBackAttach   = newLeftTri.transform.Find("left_tri_scalene_back_attach");
            Transform leftTriScaleneSideAttach   = newLeftTri.transform.Find("left_tri_scalene_side_attach");

            FuseAttributes fuseAtts = leftTriFuses();

            leftTriRingLargePartAttach.gameObject.AddComponent <FuseBehavior>();
            leftTriRingLargePartAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            leftTriRingLargePartAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LeftTri"));

            leftTriScaleneBackAttach.gameObject.AddComponent <FuseBehavior>();
            leftTriScaleneBackAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            leftTriScaleneBackAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LeftTri"));

            leftTriScaleneSideAttach.gameObject.AddComponent <FuseBehavior>();
            leftTriScaleneSideAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            leftTriScaleneSideAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LeftTri"));


            instantiated[4] = newLeftTri;
            partCreated[4]  = true;
            selectionManager.newPartCreated("left_tri_harderPrefab(Clone)");

            enableManipulationButtons(newLeftTri);
        }
    }
Пример #12
0
    public void createCalf()
    {
        if (!partCreated[1])
        {
            clearPartsCreated();
            Vector3    pos            = new Vector3(-30, 25, 140); // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 0, 90);
            GameObject newCalf        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[1], pos, fuseToRotation)));

            Transform calfTopAttach    = newCalf.transform.FindChild("Calf_Top_Attach");
            Transform calfBottomAttach = newCalf.transform.FindChild("Calf_Bottom_Attach");

            FuseAttributes fuseAtts = calfFuses();
            calfTopAttach.gameObject.AddComponent <FuseBehavior>();
            calfTopAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            calfTopAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Calf"));

            calfBottomAttach.gameObject.AddComponent <FuseBehavior>();
            calfBottomAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            calfBottomAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Calf"));

            instantiated[1] = newCalf;
            partCreated[1]  = true;
            selectionManager.newPartCreated("calfPrefab(Clone)");

            enableManipulationButtons(newCalf);
        }
    }
Пример #13
0
    public void createToe()
    {
        if (!partCreated[3])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = new Quaternion();
            GameObject newToe         = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[3], pos, fuseToRotation)));

            Transform toeBottomAttach = newToe.transform.FindChild("Toe_Bottom_Attach");
            Transform toeSideAttach   = newToe.transform.FindChild("Toe_Side_Attach");

            FuseAttributes fuseAtts = toeFuses();

            toeBottomAttach.gameObject.AddComponent <FuseBehavior>();
            toeBottomAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            toeBottomAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Toe"));

            toeSideAttach.gameObject.AddComponent <FuseBehavior>();
            toeSideAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            toeSideAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Toe"));

            instantiated[3] = newToe;
            partCreated[3]  = true;
            selectionManager.newPartCreated("ToePrefab(Clone)");

            enableManipulationButtons(newToe);
        }
    }
Пример #14
0
    public void createHandleBottom()
    {
        if (!partCreated[7])
        {
            clearPartsCreated();
            Vector3    pos             = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation  = Quaternion.Euler(0, 90, 0);
            GameObject newHandleBottom = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[7], pos, fuseToRotation)));

            Transform handleBottomCenterBoxAttach = newHandleBottom.transform.Find("handle_bottom_center_box_attach");
            Transform handleBottomHandleTopAttach = newHandleBottom.transform.Find("handle_bottom_handle_top_attach");

            FuseAttributes fuseAtts = handleBottomFuses();

            handleBottomCenterBoxAttach.gameObject.AddComponent <FuseBehavior>();
            handleBottomCenterBoxAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            handleBottomCenterBoxAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("HandleBottom"));

            handleBottomHandleTopAttach.gameObject.AddComponent <FuseBehavior>();
            handleBottomHandleTopAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            handleBottomHandleTopAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("HandleBottom"));

            instantiated[7] = newHandleBottom;
            partCreated[7]  = true;
            selectionManager.newPartCreated("handle_bottomPrefab(Clone)");

            enableManipulationButtons(newHandleBottom);
        }
    }
Пример #15
0
    public void createLeftSupport()
    {
        if (!partCreated[5])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 0, 90);
            GameObject newLeftSupport = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[5], pos, fuseToRotation)));

            Transform leftSupportAxleAttach     = newLeftSupport.transform.FindChild("left_support_axle_attach");
            Transform leftSupportPlatformAttach = newLeftSupport.transform.FindChild("left_support_platform_attach");

            FuseAttributes fuseAtts = leftSupportFuses();

            leftSupportAxleAttach.gameObject.AddComponent <FuseBehavior>();
            leftSupportAxleAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            leftSupportAxleAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LeftSupport"));

            leftSupportPlatformAttach.gameObject.AddComponent <FuseBehavior>();
            leftSupportPlatformAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            leftSupportPlatformAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LeftSupport"));

            instantiated[5] = newLeftSupport;
            partCreated[5]  = true;
            selectionManager.newPartCreated("left_support_completePrefab(Clone)");

            enableManipulationButtons(newLeftSupport);
        }
    }
Пример #16
0
    public void createRightCover()
    {
        if (!partCreated[4])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 0, 90);
            GameObject newRightCover  = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[4], pos, fuseToRotation)));

            Transform rightCoverBackAttach      = newRightCover.transform.FindChild("right_cover_back_attach");
            Transform rightCoverBackSlopeAttach = newRightCover.transform.FindChild("right_cover_back_slope_attach");

            FuseAttributes fuseAtts = rightCoverFuses();

            rightCoverBackAttach.gameObject.AddComponent <FuseBehavior>();
            rightCoverBackAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            rightCoverBackAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("RightCover"));

            rightCoverBackSlopeAttach.gameObject.AddComponent <FuseBehavior>();
            rightCoverBackSlopeAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            rightCoverBackSlopeAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("RightCover"));

            instantiated[4] = newRightCover;
            partCreated[4]  = true;
            selectionManager.newPartCreated("right_coverPrefab(Clone)");

            enableManipulationButtons(newRightCover);
        }
    }
Пример #17
0
    public void createBack()
    {
        if (!partCreated[1])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 180, 0);
            GameObject newBack        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[1], pos, fuseToRotation)));

            Transform backLeftCoverAttach  = newBack.transform.FindChild("back_left_cover_attach");
            Transform backRightCoverAttach = newBack.transform.FindChild("back_right_cover_attach");
            Transform backBridgeAttach     = newBack.transform.FindChild("back_bridge_attach");

            FuseAttributes fuseAtts = backFuses();

            backLeftCoverAttach.gameObject.AddComponent <FuseBehavior>();
            backLeftCoverAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            backLeftCoverAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Back"));

            backRightCoverAttach.gameObject.AddComponent <FuseBehavior>();
            backRightCoverAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            backRightCoverAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Back"));

            backBridgeAttach.gameObject.AddComponent <FuseBehavior>();
            backBridgeAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            backBridgeAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Back"));

            instantiated[1] = newBack;
            partCreated[1]  = true;
            selectionManager.newPartCreated("backPrefab(Clone)");

            enableManipulationButtons(newBack);
        }
    }
Пример #18
0
 static void EnsureRefExists()
 {
     if (selfRef == null)
     {
         GameObject instance = Instantiate(Resources.Load("Prefabs/SceneManager") as GameObject);
         selfRef = instance.GetComponent <LoadUtils>();
     }
 }
Пример #19
0
    // Use this for initialization
    void Start()
    {
        //加载要显示的对象的预设体
        GameObject prefab = LoadUtils.LoadPrefabFromResources(ConfigureClass.itemsPrefabPath["result"] + ConfigureClass.showModelInRepository);

        //显示该对象
        Instantiate(prefab);
    }
Пример #20
0
    IEnumerator loader(string unload, string load)
    {
        LoadUtils.LoadScene(load);
        yield return(null);

        yield return(null);

        LoadUtils.UnloadScene(unload);
    }
Пример #21
0
 public static PriceScript Load(string Path)
 {
     try
     {
         var script = LoadUtils.Load <PriceScript>(Path, false);
         return(script);
     }
     catch
     {
         N.Note("Can't read PriceScript " + Path);
         return(null);
     }
 }
Пример #22
0
    public void createHead()
    {
        if (!partCreated[3])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(90, 180, 0);
            GameObject newHead        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[3], pos, fuseToRotation)));

            Transform headTrapezoidAttach        = newHead.transform.Find("head_trapezoid_attach");
            Transform headTipAttach              = newHead.transform.Find("head_tip_attach");
            Transform headBottomPointLeftAttach  = newHead.transform.Find("head_bottom_point_left_attach");
            Transform headBottomPointRightAttach = newHead.transform.Find("head_bottom_point_right_attach");
            Transform headTopPointLeftAttach     = newHead.transform.Find("head_top_point_left_attach");
            Transform headTopPointRightAttach    = newHead.transform.Find("head_top_point_right_attach");

            FuseAttributes fuseAtts = headFuses();

            headTrapezoidAttach.gameObject.AddComponent <FuseBehavior>();
            headTrapezoidAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            headTrapezoidAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Head"));

            headTipAttach.gameObject.AddComponent <FuseBehavior>();
            headTipAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            headTipAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Head"));

            headBottomPointLeftAttach.gameObject.AddComponent <FuseBehavior>();
            headBottomPointLeftAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            headBottomPointLeftAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Head"));

            headBottomPointRightAttach.gameObject.AddComponent <FuseBehavior>();
            headBottomPointRightAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            headBottomPointRightAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Head"));

            headTopPointLeftAttach.gameObject.AddComponent <FuseBehavior>();
            headTopPointLeftAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            headTopPointLeftAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Head"));

            headTopPointRightAttach.gameObject.AddComponent <FuseBehavior>();
            headTopPointRightAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            headTopPointRightAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Head"));

            instantiated[3]             = newHead;
            partCreated[3]              = true;
            partButtons[3].interactable = false;

            selectionManager.newPartCreated("head_harderPrefab(Clone)");

            enableManipulationButtons(newHead);
        }
    }
Пример #23
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         if (tokenRequired == "")
         {
             LoadUtils.LoadNewExplorationLevel(levelName, spawnPosition);
         }
         else if (ConversationTrigger.GetToken(tokenRequired))
         {
             LoadUtils.LoadNewExplorationLevel(levelName, spawnPosition);
         }
     }
 }
Пример #24
0
    public void LoadUtils_SetParentDefaults_LoadSimple()
    {
        var doc = FromString(@"
            basic:
                intKey: 1
                stringKey: 2
            ");

        Dictionary <string, TestClass> d = null;

        LoadUtils.SetParentDefaults(ref d, doc, TestClass.getBasedOn);
        Assert.AreEqual(1, d.Count);
        Assert.AreEqual(1, d["basic"].intKey.Value);
        Assert.AreEqual("2", d["basic"].stringKey);
    }
Пример #25
0
    //CHANGE these next 5 methods so that they refer to the 5 prefabs you made. This requires you to
    // change most of the variables and strings in each method.

    public void createLongL()
    {
        if (!partCreated[0])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = new Quaternion();
            GameObject newLongL       = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[0], pos, fuseToRotation)));

            Transform longLBigCornerAttach     = newLongL.transform.FindChild("long_l_big_corner_attach");
            Transform longLCornerAttach        = newLongL.transform.FindChild("long_l_corner_attach");
            Transform longLBlockJutsSideAttach = newLongL.transform.FindChild("long_l_block_juts_side_attach");
            Transform longLBlockJutsBackAttach = newLongL.transform.FindChild("long_l_block_juts_back_attach");
            Transform longLBlockJutsTopAttach  = newLongL.transform.FindChild("long_l_block_juts_top_attach");



            FuseAttributes fuseAtts = longLFuses();

            longLBigCornerAttach.gameObject.AddComponent <FuseBehavior>();
            longLBigCornerAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            longLBigCornerAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LongL"));

            longLCornerAttach.gameObject.AddComponent <FuseBehavior>();
            longLCornerAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            longLCornerAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LongL"));

            longLBlockJutsSideAttach.gameObject.AddComponent <FuseBehavior>();
            longLBlockJutsSideAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            longLBlockJutsSideAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LongL"));

            longLBlockJutsBackAttach.gameObject.AddComponent <FuseBehavior>();
            longLBlockJutsBackAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            longLBlockJutsBackAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LongL"));

            longLBlockJutsTopAttach.gameObject.AddComponent <FuseBehavior>();
            longLBlockJutsTopAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            longLBlockJutsTopAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("LongL"));


            instantiated[0] = newLongL;
            partCreated[0]  = true;
            selectionManager.newPartCreated("long_lPrefab(Clone)");

            enableManipulationButtons(newLongL);
        }
    }
Пример #26
0
    public void LoadUtils_SetParentDefaults_IgnoreFields()
    {
        var doc = FromString(@"
            default:
                intKey: 0
                stringKey: a
            basic:
                basedOn: default
            ");

        Dictionary <string, TestClass> d = null;

        LoadUtils.SetParentDefaults(ref d, doc, TestClass.getBasedOn,
                                    new string[] { "basedOn", "intKey" });
        Assert.AreEqual(null, d["basic"].intKey);
        Assert.AreEqual("a", d["basic"].stringKey);
    }
Пример #27
0
    public void LoadUtils_SetParentDefaults_LoadParented()
    {
        var doc = FromString(@"
            default:
                intKey: 0
                stringKey: a
            basic:
                basedOn: default
                intKey: 1
            ");

        Dictionary <string, TestClass> d = null;

        LoadUtils.SetParentDefaults(ref d, doc, TestClass.getBasedOn);
        Assert.AreEqual(2, d.Count);
        Assert.AreEqual(1, d["basic"].intKey.Value);
        Assert.AreEqual("a", d["basic"].stringKey);
    }
Пример #28
0
    //CHANGE these next 5 methods so that they refer to the 5 prefabs you made. This requires you to
    // change most of the variables and strings in each method.

    public void createAxle()
    {
        if (!partCreated[0])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(90, 270, 0);
            GameObject newAxle        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[0], pos, fuseToRotation)));

            Transform axleLeftSupportAttach       = newAxle.transform.FindChild("axle_left_support_attach");
            Transform axleRightSupportAttach      = newAxle.transform.FindChild("axle_right_support_attach");
            Transform axleThrowingArmLeftAttach   = newAxle.transform.FindChild("axle_throwing_arm_left_attach");
            Transform axleThrowingArmRightAttach  = newAxle.transform.FindChild("axle_throwing_arm_right_attach");
            Transform axleThrowingArmBottomAttach = newAxle.transform.FindChild("axle_throwing_arm_bottom_attach");

            FuseAttributes fuseAtts = axleFuses();

            axleLeftSupportAttach.gameObject.AddComponent <FuseBehavior>();
            axleLeftSupportAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            axleLeftSupportAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Axle"));

            axleRightSupportAttach.gameObject.AddComponent <FuseBehavior>();
            axleRightSupportAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            axleRightSupportAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Axle"));

            axleThrowingArmLeftAttach.gameObject.AddComponent <FuseBehavior>();
            axleThrowingArmLeftAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            axleThrowingArmLeftAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Axle"));

            axleThrowingArmRightAttach.gameObject.AddComponent <FuseBehavior>();
            axleThrowingArmRightAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            axleThrowingArmRightAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Axle"));

            axleThrowingArmBottomAttach.gameObject.AddComponent <FuseBehavior>();
            axleThrowingArmBottomAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            axleThrowingArmBottomAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Axle"));

            instantiated[0] = newAxle;
            partCreated[0]  = true;
            selectionManager.newPartCreated("axlePrefab(Clone)");

            enableManipulationButtons(newAxle);
        }
    }
Пример #29
0
    public void createFrontAxle()
    {
        if (!partCreated[4])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 180, 90);
            GameObject newFrontAxle   = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[4], pos, fuseToRotation)));

            Transform frontAxleBackAxleAttach       = newFrontAxle.transform.FindChild("front_axle_back_axle_attach");
            Transform frontAxleFrontLeftWheelAttach = newFrontAxle.transform.FindChild("front_axle_front_left_wheel_attach");
            Transform frontAxlePlatformLeftAttach   = newFrontAxle.transform.FindChild("front_axle_platform_left_attach");
            Transform frontAxlePlatformRightAttach  = newFrontAxle.transform.FindChild("front_axle_platform_right_attach");
            Transform frontAxlePlatformBottomAttach = newFrontAxle.transform.FindChild("front_axle_platform_bottom_attach");

            FuseAttributes fuseAtts = frontAxleFuses();

            frontAxleBackAxleAttach.gameObject.AddComponent <FuseBehavior>();
            frontAxleBackAxleAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            frontAxleBackAxleAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("FrontAxle"));

            frontAxleFrontLeftWheelAttach.gameObject.AddComponent <FuseBehavior>();
            frontAxleFrontLeftWheelAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            frontAxleFrontLeftWheelAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("FrontAxle"));

            frontAxlePlatformLeftAttach.gameObject.AddComponent <FuseBehavior>();
            frontAxlePlatformLeftAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            frontAxlePlatformLeftAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("FrontAxle"));

            frontAxlePlatformRightAttach.gameObject.AddComponent <FuseBehavior>();
            frontAxlePlatformRightAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            frontAxlePlatformRightAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("FrontAxle"));

            frontAxlePlatformBottomAttach.gameObject.AddComponent <FuseBehavior>();
            frontAxlePlatformBottomAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            frontAxlePlatformBottomAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("FrontAxle"));

            instantiated[4] = newFrontAxle;
            partCreated[4]  = true;
            selectionManager.newPartCreated("front_axle_completePrefab(Clone)");

            enableManipulationButtons(newFrontAxle);
        }
    }
Пример #30
0
    void Start()
    {
        invController      = transform.parent.parent.GetComponent <InventoryController>();
        indicator_s        = indicator;  // Need to ignore static limitations...
        build              = GetComponent <Button>();
        build.interactable = false;
        indicator.SetActive(false);

        build.onClick.AddListener(() =>
        {
            // Save player info before entering.
            // TODO: re-implement for final version of game?
            InventoryController.levelName = SceneManager.GetActiveScene().name;

            // Record data.
            SimpleData.WriteDataPoint("Constructing_Item", "", "", "", "", whatToBuild);
            //SimpleData.WriteStringToFile("ModeSwitches.txt", Time.time + ",MODESWITCH_TO," + whatToBuild);

            // Enter.

            // Special cases for tutorial progress.
            if (whatToBuild == "tutorial1")
            {
                if (ConversationTrigger.GetToken("done_with_tutorial_2"))
                {
                    LoadUtils.LoadScene("rocketBoots");
                }
                else if (ConversationTrigger.GetToken("done_with_tutorial_1"))
                {
                    LoadUtils.LoadScene("tutorial2");
                }
                else
                {
                    LoadUtils.LoadScene("tutorial1");
                }
            }
            else              // Normal function.
            {
                LoadUtils.LoadScene(whatToBuild);
            }

            invController.CloseInventory();
        });
    }