コード例 #1
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);
        }
    }
コード例 #2
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);
        }
    }
コード例 #3
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);
        }
    }
コード例 #4
0
    public FuseAttributes blueTriFuses()
    {
        //fuse locations: 1
        //acceptable rotations: 1
        GameObject centerTri = GameObject.Find("center_tri_harderPrefab(Clone)");

        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();
        Vector3 fuseLocation = new Vector3(0, 0, 0);

        if (centerTri != null)
        {
            Vector3 centerTriPos = centerTri.transform.position;
            fuseLocation = new Vector3(centerTriPos.x + 8.2f, centerTriPos.y, centerTriPos.z + 2.4f);
            Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

            fuseLocations.Add("center_tri_blue_tri_back_attach", fuseLocation);
            fuseLocations.Add("center_tri_blue_tri_side_attach", fuseLocation);
            fuseRotations.Add("center_tri_blue_tri_back_attach", fuseRotation);
            fuseRotations.Add("center_tri_blue_tri_side_attach", fuseRotation);
            Quaternion   acceptableRotation1 = Quaternion.Euler(270, 0, 0);
            Quaternion[] acceptableRotations = { acceptableRotation1 };
            fusePositions.Add("center_tri_blue_tri_back_attach", acceptableRotations);
            fusePositions.Add("center_tri_blue_tri_side_attach", acceptableRotations);
        }

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #5
0
    // y+ = up, y- = down
    // z+ = back, z- = front
    // x+ = right, x- = left
    // (looking at object from the front)

    //returns list of objects ring can fuse to
    public FuseAttributes palmFuses()
    {
        //fuseLocations for palm: arm palm
        //acceptable rotations: 1

        GameObject arm          = startObject;
        Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 180, 0));
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();

        Vector3 armPos       = arm.transform.position;
        Vector3 fuseLocation = new Vector3(armPos.x, armPos.y + 4.5f, armPos.z - 30);

        fuseLocations.Add("arm_palm_attach", fuseLocation);
        fuseRotations.Add("arm_palm_attach", fuseRotation);

        Quaternion acceptableRotation1 = Quaternion.Euler(270, 180, 0);

        Quaternion[] acceptableRotations = { acceptableRotation1 };
        fusePositions.Add("arm_palm_attach", acceptableRotations);

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #6
0
    public FuseAttributes rightTriChunkFuses()
    {
        //fuse locations: 1
        //acceptable rotations: 1
        GameObject rightTri = GameObject.Find("right_tri_harderPrefab(Clone)");

        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();
        Vector3 fuseLocation = new Vector3(0, 0, 0);

        if (rightTri != null)
        {
            Vector3 rightTriPos = rightTri.transform.position;
            fuseLocation = new Vector3(rightTriPos.x - 7.3f, rightTriPos.y, rightTriPos.z - 0.2f);
            Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

            fuseLocations.Add("right_tri_right_tri_chunk_angle_attach", fuseLocation);
            fuseLocations.Add("right_tri_right_tri_chunk_back_attach", fuseLocation);
            fuseLocations.Add("right_tri_right_tri_chunk_side_attach", fuseLocation);
            fuseRotations.Add("right_tri_right_tri_chunk_angle_attach", fuseRotation);
            fuseRotations.Add("right_tri_right_tri_chunk_back_attach", fuseRotation);
            fuseRotations.Add("right_tri_right_tri_chunk_side_attach", fuseRotation);
            Quaternion   acceptableRotation1 = Quaternion.Euler(270, 0, 0);
            Quaternion[] acceptableRotations = { acceptableRotation1 };
            fusePositions.Add("right_tri_right_tri_chunk_angle_attach", acceptableRotations);
            fusePositions.Add("right_tri_right_tri_chunk_back_attach", acceptableRotations);
            fusePositions.Add("right_tri_right_tri_chunk_side_attach", acceptableRotations);
        }

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #7
0
    public FuseAttributes scaleneFuses()
    {
        //fuse locations: 1
        //acceptable rotations: 1
        GameObject leftTri = GameObject.Find("left_tri_harderPrefab(Clone)");

        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();
        Vector3 fuseLocation = new Vector3(0, 0, 0);

        if (leftTri != null)
        {
            Vector3 leftTriPos = leftTri.transform.position;
            fuseLocation = new Vector3(leftTriPos.x + 2.4f, leftTriPos.y, leftTriPos.z + 6.5f);
            Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

            fuseLocations.Add("left_tri_scalene_back_attach", fuseLocation);
            fuseLocations.Add("left_tri_scalene_side_attach", fuseLocation);
            fuseRotations.Add("left_tri_scalene_back_attach", fuseRotation);
            fuseRotations.Add("left_tri_scalene_side_attach", fuseRotation);
            Quaternion   acceptableRotation1 = Quaternion.Euler(90, 0, 0);
            Quaternion[] acceptableRotations = { acceptableRotation1 };
            fusePositions.Add("left_tri_scalene_back_attach", acceptableRotations);
            fusePositions.Add("left_tri_scalene_side_attach", acceptableRotations);
        }

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #8
0
    public FuseAttributes rightTriFuses()
    {
        //fuse locations: 1
        //acceptable rotations: 1
        GameObject ringSmallPart = GameObject.Find("ring_small_partPrefab(Clone)");

        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();
        Vector3 fuseLocation = new Vector3(0, 0, 0);

        if (ringSmallPart != null)
        {
            Vector3 ringPos = ringSmallPart.transform.position;
            fuseLocation = new Vector3(ringPos.x, ringPos.y, ringPos.z - 12.5f);
            Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

            fuseLocations.Add("ring_small_part_right_tri_attach", fuseLocation);
            fuseRotations.Add("ring_small_part_right_tri_attach", fuseRotation);
            Quaternion   acceptableRotation1 = Quaternion.Euler(270, 0, 0);
            Quaternion[] acceptableRotations = { acceptableRotation1 };
            fusePositions.Add("ring_small_part_right_tri_attach", acceptableRotations);
        }

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #9
0
    public FuseAttributes centerTriFuses()
    {
        //fuseLocations: 1
        //acceptable rotations: 2
        GameObject ringLongPart = GameObject.Find("ring_long_partPrefab(Clone)");
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();

        if (ringLongPart != null)
        {
            Vector3 ringLongPartPos = ringLongPart.transform.position;
            Vector3 fuseLocation    = new Vector3(ringLongPartPos.x + 7.5f, ringLongPartPos.y, ringLongPartPos.z);
            fuseLocations.Add("ring_long_part_center_tri_attach", fuseLocation);
            Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));
            fuseRotations.Add("ring_long_part_center_tri_attach", fuseRotation);

            Quaternion   acceptableRotation1 = Quaternion.Euler(270, 0, 0);
            Quaternion   acceptableRotation2 = Quaternion.Euler(90, 0, 0);
            Quaternion[] acceptableRotations = { acceptableRotation1, acceptableRotation2 };
            fusePositions = new Dictionary <string, Quaternion[]>();
            fusePositions.Add("ring_long_part_center_tri_attach", acceptableRotations);
        }

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #10
0
    public FuseAttributes fingersFuses()
    {
        //fuseLocations: 1
        //acceptable rotations: 1
        GameObject palm = GameObject.Find("palmPrefab(Clone)");
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();

        if (palm != null)
        {
            Vector3 palmPos      = palm.transform.position;
            Vector3 fuseLocation = new Vector3(palmPos.x, palmPos.y, palmPos.z - 17);
            fuseLocations.Add("palm_fingers_attach", fuseLocation);
            Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 180, 0));
            fuseRotations.Add("palm_fingers_attach", fuseRotation);

            Quaternion   acceptableRotation1 = Quaternion.Euler(270, 180, 0);
            Quaternion[] acceptableRotations = { acceptableRotation1 };
            fusePositions = new Dictionary <string, Quaternion[]>();
            fusePositions.Add("palm_fingers_attach", acceptableRotations);
        }

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #11
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);
        }
    }
コード例 #12
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);
        }
    }
コード例 #13
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);
        }
    }
コード例 #14
0
    // y+ = up, y- = down
    // z+ = back, z- = front
    // x+ = right, x- = left
    // (looking at object from the front)

    //returns list of objects ring can fuse to
    public FuseAttributes ringLargePartFuses()
    {
        //fuseLocations for ring: center box ring left
        //						  center box ring right
        //						  center box ring back
        //						  center box ring forward
        //acceptable rotations: 2

        GameObject centerBox     = startObject;
        GameObject ringLongPart  = GameObject.Find("ring_long_partPrefab(Clone)");
        GameObject ringSmallPart = GameObject.Find("ring_small_partPrefab(Clone)");

        Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();

        Vector3 centerBoxPos = centerBox.transform.position;
        Vector3 fuseLocation = new Vector3(centerBoxPos.x, centerBoxPos.y, centerBoxPos.z);

        fuseLocations.Add("center_box_ring_large_part_attach", fuseLocation);
        fuseLocations.Add("center_box_ring_large_part_left_attach", fuseLocation);
        fuseRotations.Add("center_box_ring_large_part_attach", fuseRotation);
        fuseRotations.Add("center_box_ring_large_part_left_attach", fuseRotation);

        Quaternion acceptableRotation1 = Quaternion.Euler(270, 0, 0);

        Quaternion[] acceptableRotations = { acceptableRotation1 };
        fusePositions.Add("center_box_ring_large_part_attach", acceptableRotations);
        fusePositions.Add("center_box_ring_large_part_left_attach", acceptableRotations);

        if (ringLongPart != null)
        {
            fuseLocations.Add("ring_long_part_ring_large_part_attach", fuseLocation);
            fuseRotations.Add("ring_long_part_ring_large_part_attach", fuseRotation);
            fusePositions.Add("ring_long_part_ring_large_part_attach", acceptableRotations);
        }

        if (ringSmallPart != null)
        {
            fuseLocations.Add("ring_small_part_ring_large_part_attach", fuseLocation);
            fuseRotations.Add("ring_small_part_ring_large_part_attach", fuseRotation);
            fusePositions.Add("ring_small_part_ring_large_part_attach", acceptableRotations);
        }

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #15
0
    public FuseAttributes toeFuses()
    {
        GameObject soleToe             = GameObject.Find("ToeSolePrefab(Clone)");
        GameObject body                = GameObject.Find("BodyPrefab(Clone)");
        Quaternion fuseRotation        = Quaternion.Euler(new Vector3(0, 180, 0));
        Quaternion acceptableRotation1 = Quaternion.Euler(new Vector3(270, 180, 0));
        Quaternion acceptableRotation2 = Quaternion.Euler(new Vector3(90, 0, 0));

        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();
        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        if (soleToe != null)
        {
            Vector3      soleToePos    = soleToe.transform.position;
            Vector3      fuseLocation1 = new Vector3(soleToePos.x, soleToePos.y + 13, soleToePos.z);
            Quaternion[] acceptableRotationsSoleToe = { acceptableRotation2 };

            fuseLocations.Add("Sole_Toe_Top_Attach", fuseLocation1);
            fuseRotations.Add("Sole_Toe_Top_Attach", fuseRotation);
            fusePositions.Add("Sole_Toe_Top_Attach", acceptableRotationsSoleToe);
        }
        if (body != null)
        {
            Vector3      bodyPos = body.transform.position;
            Quaternion[] acceptableRotationsBody = { acceptableRotation1 };
            if (soleToe == null)
            {
                Vector3 fuseLocation2 = new Vector3(bodyPos.x, bodyPos.y + 3, bodyPos.z - 35);

                fuseLocations.Add("Body_Side_Attach", fuseLocation2);
                fuseRotations.Add("Body_Side_Attach", fuseRotation);
            }
            else
            {
                Vector3 soleToePos    = soleToe.transform.position;
                Vector3 fuseLocation1 = new Vector3(soleToePos.x, soleToePos.y + 13, soleToePos.z);
                fuseLocations.Add("Body_Side_Attach", fuseLocation1);
                fuseRotations.Add("Body_Side_Attach", fuseRotation);
            }
            fusePositions.Add("Body_Side_Attach", acceptableRotationsBody);
        }

        newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #16
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);
        }
    }
コード例 #17
0
    // y+ = up, y- = down
    // z+ = back, z- = front
    // x+ = right, x- = left
    // (looking at boot from the front)

    //returns list of objects body can fuse to
    public FuseAttributes b2p1Fuses()
    {
        GameObject bb2 = startObject;
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();

        Vector3 bb2Pos       = bb2.transform.position;
        Vector3 fuseLocation = new Vector3(bb2Pos.x, bb2Pos.y, bb2Pos.z);

        fuseLocations.Add("bb2_b2p1_a1", fuseLocation);
        fuseLocations.Add("bb2_b2p1_a2", fuseLocation);
        fuseLocations.Add("bb2_b2p1_a3", fuseLocation);
        fuseLocations.Add("bb2_b2p1_a4", fuseLocation);
        fuseLocations.Add("bb2_b2p1_a5", fuseLocation);
        fuseLocations.Add("b2p2_b2p1_a1", fuseLocation);
        fuseLocations.Add("b2p2_b2p1_a2", fuseLocation);

        Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

        fuseRotations.Add("bb2_b2p1_a1", fuseRotation);
        fuseRotations.Add("bb2_b2p1_a2", fuseRotation);
        fuseRotations.Add("bb2_b2p1_a3", fuseRotation);
        fuseRotations.Add("bb2_b2p1_a4", fuseRotation);
        fuseRotations.Add("bb2_b2p1_a5", fuseRotation);
        fuseRotations.Add("b2p2_b2p1_a1", fuseRotation);
        fuseRotations.Add("b2p2_b2p1_a2", fuseRotation);

        Quaternion acceptableRotation1 = Quaternion.Euler(270, 0, 0);

        //Quaternion acceptableRotation2 = Quaternion.Euler(0, 90, 270);
        //Quaternion acceptableRotation3 = Quaternion.Euler(90, 180, 0);
        //Quaternion acceptableRotation4 = Quaternion.Euler(0, 270, 90);
        Quaternion[] acceptableRotations = { acceptableRotation1 };
        fusePositions.Add("bb2_b2p1_a1", acceptableRotations);
        fusePositions.Add("bb2_b2p1_a2", acceptableRotations);
        fusePositions.Add("bb2_b2p1_a3", acceptableRotations);
        fusePositions.Add("bb2_b2p1_a4", acceptableRotations);
        fusePositions.Add("bb2_b2p1_a5", acceptableRotations);
        fusePositions.Add("b2p2_b2p1_a1", acceptableRotations);
        fusePositions.Add("b2p2_b2p1_a2", acceptableRotations);

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #18
0
    public void createB1p2()
    {
        if (!partCreated[1])
        {
            clearPartsCreated();
            Vector3    pos            = offscreenCreateLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 180, 0);
            GameObject newB1p2        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[1], pos, fuseToRotation)));
            StartCoroutine(moveToStartingPosition(newB1p2)); // this creates the zooming up from the ground effect

            Transform b1p2        = newB1p2.transform.Find("b1p2");
            Transform b1p2_bb1_a1 = newB1p2.transform.Find("b1p2_bb1_a1");
            Transform b1p2_bb1_a2 = newB1p2.transform.Find("b1p2_bb1_a2");
            b1p2.GetComponent <Tooltip>().enabled        = true;
            b1p2_bb1_a1.GetComponent <Tooltip>().enabled = true;
            b1p2_bb1_a2.GetComponent <Tooltip>().enabled = true;

            FuseAttributes fuseAtts = b1p2Fuses();

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

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

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

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


            instantiated[1]             = newB1p2;
            partCreated[1]              = true;
            partButtons[1].interactable = false;

            selectionManager.newPartCreated("b1p2Prefab(Clone)");
        }
    }
コード例 #19
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);
        }
    }
コード例 #20
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);
        }
    }
コード例 #21
0
    public void createRingLargePart()
    {
        if (!partCreated[0])
        {
            clearPartsCreated();
            Vector3    pos              = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation   = Quaternion.Euler(0, 180, 0);
            GameObject newRingLargePart = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[0], pos, fuseToRotation)));

            Transform ringLargePartCenterBoxSideAttach = newRingLargePart.transform.Find("ring_large_part_center_box_side_attach");
            Transform ringLargePartRingLongPartAttach  = newRingLargePart.transform.Find("ring_large_part_ring_long_part_attach");
            Transform ringLargePartCenterBoxBackAttach = newRingLargePart.transform.Find("ring_large_part_center_box_back_attach");
            Transform ringLargePartRingSmallPartAttach = newRingLargePart.transform.Find("ring_large_part_ring_small_part_attach");
            Transform ringLargePartLeftTriAttach       = newRingLargePart.transform.Find("ring_large_part_tri_attach");

            FuseAttributes fuseAtts = ringLargePartFuses();

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

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

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

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

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

            instantiated[0] = newRingLargePart;
            partCreated[0]  = true;
            selectionManager.newPartCreated("ring_large_partPrefab(Clone)");

            enableManipulationButtons(newRingLargePart);
        }
    }
コード例 #22
0
    public FuseAttributes b4p3Fuses()
    {
        GameObject bb4 = startObject;
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();


        Vector3 bb4Pos       = bb4.transform.position;
        Vector3 fuseLocation = new Vector3(bb4Pos.x, bb4Pos.y, bb4Pos.z - 8f);

        fuseLocations.Add("bb4_b4p3_a1", fuseLocation);
        fuseLocations.Add("bb4_b4p3_a2", fuseLocation);
        fuseLocations.Add("bb4_b4p3_a3", fuseLocation);
        fuseLocations.Add("b4p1_b4p3_a1", fuseLocation);
        fuseLocations.Add("b4p1_b4p3_a2", fuseLocation);
        fuseLocations.Add("b4p2_b4p3_a1", fuseLocation);
        fuseLocations.Add("b4p2_b4p3_a2", fuseLocation);
        Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

        fuseRotations.Add("bb4_b4p3_a1", fuseRotation);
        fuseRotations.Add("bb4_b4p3_a2", fuseRotation);
        fuseRotations.Add("bb4_b4p3_a3", fuseRotation);
        fuseRotations.Add("b4p1_b4p3_a1", fuseRotation);
        fuseRotations.Add("b4p1_b4p3_a2", fuseRotation);
        fuseRotations.Add("b4p2_b4p3_a1", fuseRotation);
        fuseRotations.Add("b4p2_b4p3_a2", fuseRotation);

        Quaternion acceptableRotation1 = Quaternion.Euler(270, 0, 0);

        Quaternion[] acceptableRotations = { acceptableRotation1 };
        fusePositions = new Dictionary <string, Quaternion[]>();
        fusePositions.Add("bb4_b4p3_a1", acceptableRotations);
        fusePositions.Add("bb4_b4p3_a2", acceptableRotations);
        fusePositions.Add("bb4_b4p3_a3", acceptableRotations);
        fusePositions.Add("b4p1_b4p3_a1", acceptableRotations);
        fusePositions.Add("b4p1_b4p3_a2", acceptableRotations);
        fusePositions.Add("b4p2_b4p3_a1", acceptableRotations);
        fusePositions.Add("b4p2_b4p3_a2", acceptableRotations);

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #23
0
    // y+ = up, y- = down
    // z+ = back, z- = front
    // x+ = right, x- = left
    // (looking at object from the front)

    //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. For now, set the fuseLocation to the
    // location of whatever part you're going to attach it to, set the fuseRotation to the location
    // (0,0,0), and make acceptableRotations contain only one rotation: Quaternion.Euler (0,0,0). Later,
    // you will come back and change fuseLocation, fuseRotation, and acceptableRotations after testing.

    //returns list of objects bridge cover can fuse to
    public FuseAttributes longLFuses()
    {
        GameObject key3         = startObject;
        Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();

        Vector3 key3Pos      = key3.transform.position;
        Vector3 fuseLocation = new Vector3(key3Pos.x + 15, key3Pos.y, key3Pos.z - 10);

        fuseLocations.Add("block_juts_long_l_back_attach", fuseLocation);
        fuseLocations.Add("block_juts_long_l_side_attach", fuseLocation);
        fuseLocations.Add("block_juts_long_l_top_attach", fuseLocation);
        fuseLocations.Add("corner_long_l_attach", fuseLocation);



        fuseRotations.Add("block_juts_long_l_back_attach", fuseRotation);
        fuseRotations.Add("block_juts_long_l_side_attach", fuseRotation);
        fuseRotations.Add("block_juts_long_l_top_attach", fuseRotation);
        fuseRotations.Add("corner_long_l_attach", fuseRotation);


        Quaternion acceptableRotation1 = Quaternion.Euler(270, 0, 0);

        Quaternion[] acceptableRotations = { acceptableRotation1 };


        Quaternion acceptableRotation2 = Quaternion.Euler(0, 90, 90);

        Quaternion[] acceptableRotations2 = { acceptableRotation2 };


        fusePositions.Add("block_juts_long_l_back_attach", acceptableRotations);
        fusePositions.Add("block_juts_long_l_side_attach", acceptableRotations);
        fusePositions.Add("block_juts_long_l_top_attach", acceptableRotations);
        fusePositions.Add("corner_long_l_attach", acceptableRotations2);


        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #24
0
    public FuseAttributes frontAxleFuses()
    {
        GameObject platform = startObject;
        GameObject backAxle = GameObject.Find("back_axle_completePrefab(Clone)");
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();

        Vector3 platformPos = platform.transform.position;

        Quaternion acceptableRotation1 = Quaternion.Euler(0, 180, 90);

        Quaternion[] acceptableRotations = { acceptableRotation1 };

        Vector3    fuseLocation = new Vector3(platformPos.x - 21, platformPos.y - 4.5f, platformPos.z);
        Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

        fuseLocations.Add("platform_front_axle_bottom_attach", fuseLocation);
        fuseRotations.Add("platform_front_axle_bottom_attach", fuseRotation);

        fuseLocations.Add("platform_front_axle_left_attach", fuseLocation);
        fuseRotations.Add("platform_front_axle_left_attach", fuseRotation);

        fuseLocations.Add("platform_front_axle_right_attach", fuseLocation);
        fuseRotations.Add("platform_front_axle_right_attach", fuseRotation);

        fusePositions.Add("platform_front_axle_bottom_attach", acceptableRotations);
        fusePositions.Add("platform_front_axle_left_attach", acceptableRotations);
        fusePositions.Add("platform_front_axle_right_attach", acceptableRotations);

        if (backAxle != null)
        {
            fuseLocations.Add("back_axle_front_axle_attach", fuseLocation);
            fuseRotations.Add("back_axle_front_axle_attach", fuseRotation);
            fusePositions.Add("back_axle_front_axle_attach", acceptableRotations);
        }


        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #25
0
    public void createCalf()
    {
        if (!partCreated[1])
        {
            clearPartsCreated();
            Vector3    pos            = offscreenCreateLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 90, 90);
            GameObject newCalf        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[1], pos, fuseToRotation)));
            StartCoroutine(moveToStartingPosition(newCalf)); // this creates the zooming up from the ground effect

            Transform calfWideningAttach = newCalf.transform.Find("calf_widening_attach");
            Transform calfTrimAttach     = newCalf.transform.Find("calf_trim_attach");

            FuseAttributes fuseAtts = calfFuses();

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

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

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

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

            instantiated[1]             = newCalf;
            partCreated[1]              = true;
            partButtons[1].interactable = false;

            selectionManager.newPartCreated("calf_harderPrefab(Clone)");
        }
    }
コード例 #26
0
    public void createWidening()
    {
        if (!partCreated[5])
        {
            clearPartsCreated();
            Vector3    pos            = offscreenCreateLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 0, 270);
            GameObject newWidening    = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[5], pos, fuseToRotation)));
            StartCoroutine(moveToStartingPosition(newWidening)); // this creates the zooming up from the ground effect

            Transform wideningHeelAttach = newWidening.transform.Find("widening_heel_attach");
            Transform wideningCalfAttach = newWidening.transform.Find("widening_calf_attach");

            FuseAttributes fuseAtts = wideningFuses();

            // widening_heel_attach
            wideningHeelAttach.gameObject.AddComponent <FuseBehavior>();
            wideningHeelAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            wideningHeelAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Widening"));

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

            // widening_calf_attach
            wideningCalfAttach.gameObject.AddComponent <FuseBehavior>();
            wideningCalfAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            wideningCalfAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Widening"));

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

            instantiated[5]             = newWidening;
            partCreated[5]              = true;
            partButtons[5].interactable = false;

            selectionManager.newPartCreated("wideningPrefab(Clone)");
        }
    }
コード例 #27
0
    public void createMidfoot()
    {
        if (!partCreated[2])
        {
            clearPartsCreated();
            Vector3    pos            = offscreenCreateLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(270, 0, 90);
            GameObject newMidfoot     = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[2], pos, fuseToRotation)));
            StartCoroutine(moveToStartingPosition(newMidfoot)); // this creates the zooming up from the ground effect

            Transform midfootHeelAttach     = newMidfoot.transform.Find("midfoot_heel_attach");
            Transform midfootBallfootAttach = newMidfoot.transform.Find("midfoot_ballfoot_attach");

            FuseAttributes fuseAtts = midfootFuses();

            // midfoot_heel_attach
            midfootHeelAttach.gameObject.AddComponent <FuseBehavior>();
            midfootHeelAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            midfootHeelAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Midfoot"));

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

            // midfoot_ballfoot_attach
            midfootBallfootAttach.gameObject.AddComponent <FuseBehavior>();
            midfootBallfootAttach.gameObject.GetComponent <FuseBehavior>().setFuseTo(fuseAtts);
            midfootBallfootAttach.gameObject.GetComponent <FuseBehavior>().setButtonTo(GameObject.Find("Midfoot"));

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

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

            selectionManager.newPartCreated("midfootPrefab(Clone)");
        }
    }
コード例 #28
0
    public void createVestDiamond()
    {
        if (!partCreated[4])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 180, 0);
            GameObject newLeftCover   = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[4], pos, fuseToRotation)));

            Transform vestDiamondLeftVestOvalAttach  = newLeftCover.transform.FindChild("vest_diamond_left_vest_oval_attach");
            Transform vestDiamondRightVestOvalAttach = newLeftCover.transform.FindChild("vest_diamond_right_vest_oval_attach");
            Transform VestDiamondVestBaseAttach      = newLeftCover.transform.FindChild("vest_diamond_vest_base_attach");
            Transform VestDiamondVestOvalAttach      = newLeftCover.transform.FindChild("vest_diamond_vest_oval_attach");



            FuseAttributes fuseAtts = vestDiamondFuses();

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

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

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

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

            instantiated[4] = newLeftCover;
            partCreated[4]  = true;
            selectionManager.newPartCreated("vest_diamondPrefab(Clone)");

            enableManipulationButtons(newLeftCover);
        }
    }
コード例 #29
0
    public FuseAttributes b3p2Fuses()
    {
        GameObject bb3 = startObject;
        Dictionary <string, Vector3>      fuseLocations = new Dictionary <string, Vector3>();
        Dictionary <string, Quaternion>   fuseRotations = new Dictionary <string, Quaternion>();
        Dictionary <string, Quaternion[]> fusePositions = new Dictionary <string, Quaternion[]>();


        Vector3 bb3Pos       = bb3.transform.position;
        Vector3 fuseLocation = new Vector3(bb3Pos.x, bb3Pos.y + 3.4f, bb3Pos.z + 13.3f);

        fuseLocations.Add("bb3_b3p2_a1", fuseLocation);
        fuseLocations.Add("bb3_b3p2_a2", fuseLocation);
        fuseLocations.Add("bb3_b3p2_a3", fuseLocation);
        fuseLocations.Add("bb3_b3p2_a4", fuseLocation);
        fuseLocations.Add("bb3_b3p2_a5", fuseLocation);
        fuseLocations.Add("bb3_b3p2_a6", fuseLocation);
        Quaternion fuseRotation = Quaternion.Euler(new Vector3(0, 0, 0));

        fuseRotations.Add("bb3_b3p2_a1", fuseRotation);
        fuseRotations.Add("bb3_b3p2_a2", fuseRotation);
        fuseRotations.Add("bb3_b3p2_a3", fuseRotation);
        fuseRotations.Add("bb3_b3p2_a4", fuseRotation);
        fuseRotations.Add("bb3_b3p2_a5", fuseRotation);
        fuseRotations.Add("bb3_b3p2_a6", fuseRotation);

        Quaternion acceptableRotation1 = Quaternion.Euler(270, 0, 0);

        Quaternion[] acceptableRotations = { acceptableRotation1 };
        fusePositions = new Dictionary <string, Quaternion[]>();
        fusePositions.Add("bb3_b3p2_a1", acceptableRotations);
        fusePositions.Add("bb3_b3p2_a2", acceptableRotations);
        fusePositions.Add("bb3_b3p2_a3", acceptableRotations);
        fusePositions.Add("bb3_b3p2_a4", acceptableRotations);
        fusePositions.Add("bb3_b3p2_a5", acceptableRotations);
        fusePositions.Add("bb3_b3p2_a6", acceptableRotations);

        FuseAttributes newAttributes = new FuseAttributes(fuseLocations, fuseRotations, fusePositions);

        return(newAttributes);
    }
コード例 #30
0
    public void createRing()
    {
        if (!partCreated[0])
        {
            clearPartsCreated();
            Vector3    pos            = createLoc; // this is where the object will appear when it's instantiated
            Quaternion fuseToRotation = Quaternion.Euler(0, 180, 0);
            GameObject newRing        = rotateGizmo.Enable(LoadUtils.InstantiateParenter((GameObject)Instantiate(parts[0], pos, fuseToRotation)));

            Transform ringCenterBoxLeftAttach    = newRing.transform.FindChild("ring_center_box_left_attach");
            Transform ringCenterBoxRightAttach   = newRing.transform.FindChild("ring_center_box_right_attach");
            Transform ringCenterBoxBackAttach    = newRing.transform.FindChild("ring_center_box_back_attach");
            Transform ringCenterBoxForwardAttach = newRing.transform.FindChild("ring_center_box_forward_attach");

            FuseAttributes fuseAtts = ringFuses();

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

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

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

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

            instantiated[0] = newRing;
            partCreated[0]  = true;
            selectionManager.newPartCreated("ringPrefab(Clone)");

            enableManipulationButtons(newRing);
        }
    }