コード例 #1
0
    bool WeldParts(GrabbablePart startPart, GrabbablePart endPart, Vector3 startPoint, Vector3 endPoint)
    {
        ClearSelections();
        // TODO
//		Debug.Log("WeldParts "+startPart+" -> "+endPart+" "+startPoint+" "+endPoint);
        if (endPart == null)
        {
            return(false);
        }

        HexMetrics.Direction direction;
        Adjancency           adjacency = IsAdjacent(startPart, endPart, out direction);

        if (adjacency == Adjancency.Adjacent)
        {
            startPart.ConnectPartAndPlaceAtRelativeDirection(endPart, GrabbablePart.PhysicalConnectionType.Weld, (HexMetrics.Direction)direction);
        }
        else if (adjacency == Adjancency.Connected)
        {
//			startPart.SetPhysicalConnection(
            PerformsConstructionFunctionThatMightSplit((con) =>
                                                       startPart.SetPhysicalConnection(direction, GrabbablePart.PhysicalConnectionType.None, GrabbablePart.SplitOptions.SplitIfNecessary));
        }

        return(true);
    }
コード例 #2
0
    bool DrawGhostWeld(GrabbablePart startPart, GrabbablePart overPart, Vector3 startPoint, Vector3 thisPoint)
    {
        ClearSelections();
        // TODO
//		Debug.Log("DrawGhostWeld "+startPart+" -> "+overPart+" "+startPoint+" "+thisPoint);
        if (overPart == null)
        {
            return(false);
        }

        HexMetrics.Direction direction;
        Adjancency           adjacency = IsAdjacent(startPart, overPart, out direction);

        if (adjacency != Adjancency.None)
        {
            startPart.highlighted = true;
            overPart.highlighted  = true;
        }


        return(false);
    }