Initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
@startuml
|
||||
class AttachableBlock {
|
||||
- blockType : BlockType
|
||||
- socketContainer : SocketContainer
|
||||
- connectedBlocks : List<AttachableBlock>
|
||||
- attachedJoints : List<JointBlock>
|
||||
+ GetConnectedBlocks() : List<AttachableBlock>
|
||||
+ GetAttachedJoints() : List<JointBlock>
|
||||
+ SetBlockType(BlockType:BlockType) : void
|
||||
+ DisconnectFrom(otherBlock:AttachableBlock) : void
|
||||
+ UnregisterJoint(joint:JointBlock) : void
|
||||
- Awake() : void
|
||||
+ GetSocketContainer() : SocketContainer
|
||||
+ ConnectTo(otherBlock:AttachableBlock, mySocket:SocketPoint, theirSocket:SocketPoint) : void
|
||||
+ RegisterJoint(joint:JointBlock) : void
|
||||
}
|
||||
enum BlockType {
|
||||
Regular,
|
||||
Link,
|
||||
Gear,
|
||||
Structural,
|
||||
}
|
||||
MonoBehaviour <|-- AttachableBlock
|
||||
@enduml
|
||||
@@ -0,0 +1,5 @@
|
||||
@startuml
|
||||
interface BlockContainerInit {
|
||||
InitBlockContainer(sockets:List<SocketPoint>) : List<SocketPoint>
|
||||
}
|
||||
@enduml
|
||||
@@ -0,0 +1,7 @@
|
||||
@startuml
|
||||
class SimpleLinkContainerInit {
|
||||
+ InitBlockContainer(sockets:List<SocketPoint>) : List<SocketPoint>
|
||||
}
|
||||
MonoBehaviour <|-- SimpleLinkContainerInit
|
||||
BlockContainerInit <|-- SimpleLinkContainerInit
|
||||
@enduml
|
||||
@@ -0,0 +1,19 @@
|
||||
@startuml
|
||||
interface ISocket {
|
||||
GetTransform() : Transform
|
||||
GetSocketType() : SocketType
|
||||
GetSocketRadius() : float
|
||||
IsOccupied() : bool
|
||||
GetOccupyingObject() : GameObject
|
||||
SetOccupied(obj:GameObject) : void
|
||||
Release() : void
|
||||
CanAccept(otherSocket:ISocket, isJoint:bool) : bool
|
||||
GetNormal() : Vector3
|
||||
}
|
||||
enum SocketType {
|
||||
Regular,
|
||||
JointHost,
|
||||
JointEnd,
|
||||
Universal,
|
||||
}
|
||||
@enduml
|
||||
@@ -0,0 +1,36 @@
|
||||
@startuml
|
||||
class JointBlock {
|
||||
- jointType : JointBlockType
|
||||
- jointLength : float = 1f
|
||||
- socketEnd1 : SocketPoint
|
||||
- socketEnd2 : SocketPoint
|
||||
- usePhysics : bool = true
|
||||
- jointBreakForce : float
|
||||
- jointBreakTorque : float
|
||||
+ connectedBlocks : List<AttachableBlock>
|
||||
- createdJoints : List<Joint>
|
||||
- isPlaced : bool = false
|
||||
- jointPlacementHandler : JointPlacementHandler
|
||||
- Awake() : void
|
||||
+ TryPlaceJoint(targetSockets:List<SocketPoint>, isGhost:bool) : bool
|
||||
- AlignToSockets(targetSockets:List<SocketPoint>, isGhost:bool) : void
|
||||
+ CreatePhysicsJoint(targetObj:GameObject, socket:SocketPoint) : void
|
||||
- CreatePhysicsJoints(targetSockets:List<SocketPoint>) : void
|
||||
- CreateJointByType(connectedBody:Rigidbody, socket:SocketPoint) : Joint
|
||||
- CreateFixedJoint(connectedBody:Rigidbody) : FixedJoint
|
||||
- CreateHingeJoint(connectedBody:Rigidbody, socket:SocketPoint) : HingeJoint
|
||||
- CreateConfigurableJoint(connectedBody:Rigidbody, socket:SocketPoint) : ConfigurableJoint
|
||||
- MarkSocketsOccupied(targetSockets:List<SocketPoint>) : void
|
||||
+ RemoveJoint() : void
|
||||
+ GetJointType() : JointBlockType
|
||||
+ GetSocketEnd1() : SocketPoint
|
||||
+ GetSocketEnd2() : SocketPoint
|
||||
+ IsPlaced() : bool
|
||||
}
|
||||
enum JointBlockType {
|
||||
FixedPivot,
|
||||
HingePivot,
|
||||
ConfigurablePivot,
|
||||
}
|
||||
MonoBehaviour <|-- JointBlock
|
||||
@enduml
|
||||
@@ -0,0 +1,15 @@
|
||||
@startuml
|
||||
class JointPlacementHandler {
|
||||
- {static} instance : JointPlacementHandler
|
||||
- socketSearchRadius : float = 1f
|
||||
- blockLayerMask : LayerMask
|
||||
+ {static} getInstance() : JointPlacementHandler
|
||||
- Awake() : void
|
||||
+ FindAllSocketsAlignedBetween(start:SocketPoint, end:SocketPoint) : List<SocketPoint>
|
||||
- IsPointOnSegment(A:Vector3, B:Vector3, P:Vector3, tolerance:float) : bool
|
||||
+ FindTargetSocketsForJoint(jointBlock:JointBlock, searchPosition:Vector3) : List<SocketPoint>
|
||||
- FindSocketAtJointEnd(firstSocket:SocketPoint, end1:SocketPoint, end2:SocketPoint) : SocketPoint
|
||||
- FindClosestSocket(position:Vector3, sockets:List<SocketPoint>) : SocketPoint
|
||||
}
|
||||
MonoBehaviour <|-- JointPlacementHandler
|
||||
@enduml
|
||||
@@ -0,0 +1,35 @@
|
||||
@startuml
|
||||
class SocketContainer {
|
||||
- sockets : List<SocketPoint>
|
||||
- iterativeSockets : List<SocketPoint>
|
||||
- autoDetectSockets : bool = true
|
||||
- allowCycling : bool = true
|
||||
- wrapAround : bool = true
|
||||
- containerInit : BlockContainerInit
|
||||
- currentSocketIndex : int = 0
|
||||
- currentActiveSocket : SocketPoint
|
||||
- Awake() : void
|
||||
- InitializeSockets() : void
|
||||
+ GetActiveSocket() : SocketPoint
|
||||
+ CycleToNextSocket() : void
|
||||
+ CycleToPreviousSocket() : void
|
||||
+ SetActiveSocketByIndex(index:int) : void
|
||||
+ SetActiveSocket(socket:SocketPoint) : void
|
||||
+ ResetToFirstSocket() : void
|
||||
+ GetAllSockets() : List<SocketPoint>
|
||||
+ GetAvailableSockets() : List<SocketPoint>
|
||||
+ GetOccupiedSockets() : List<SocketPoint>
|
||||
+ FindNearestCompatibleSocket(worldPosition:Vector3, sourceSocket:SocketPoint) : SocketPoint
|
||||
+ FindSocketsInRadius(worldPosition:Vector3, radius:float, onlyAvailable:bool) : List<SocketPoint>
|
||||
+ GetSocketsByType(type:SocketType) : List<SocketPoint>
|
||||
+ HighlightAllSockets(state:HighlightState) : void
|
||||
+ ClearAllHighlights() : void
|
||||
+ AddSocket(socket:SocketPoint) : void
|
||||
+ RemoveSocket(socket:SocketPoint) : void
|
||||
+ GetSocketCount() : int
|
||||
+ HasSockets() : bool
|
||||
+ GetCurrentSocketIndex() : int
|
||||
+ FindSocketsCompatibleWithJoint(jointBlock:JointBlock) : List<SocketPoint>
|
||||
}
|
||||
MonoBehaviour <|-- SocketContainer
|
||||
@enduml
|
||||
@@ -0,0 +1,15 @@
|
||||
@startuml
|
||||
class SocketIterator {
|
||||
- {static} instance : SocketIterator
|
||||
+ {static} getInstance() : SocketIterator
|
||||
- currentActiveContainer : SocketContainer
|
||||
- currentActiveSocket : SocketPoint
|
||||
- inputProvider : BaseInputProvider
|
||||
- Awake() : void
|
||||
- Start() : void
|
||||
+ SetActiveContainer(container:SocketContainer) : void
|
||||
+ GetCurrentActiveSocket() : SocketPoint
|
||||
+ ClearActiveContainer() : void
|
||||
}
|
||||
MonoBehaviour <|-- SocketIterator
|
||||
@enduml
|
||||
@@ -0,0 +1,44 @@
|
||||
@startuml
|
||||
class SocketPoint {
|
||||
- socketType : SocketType
|
||||
- socketRadius : float = 0.1f
|
||||
- socketNormal : Vector3
|
||||
- acceptableTypes : List<SocketType>
|
||||
- radiusTolerance : float = 0.05f
|
||||
- visualIndicator : GameObject
|
||||
- defaultColor : Color
|
||||
- activeColor : Color
|
||||
- compatibleColor : Color
|
||||
- incompatibleColor : Color
|
||||
- canHoldJoint : bool = false
|
||||
- occupyingObject : GameObject
|
||||
- isOccupied : bool = false
|
||||
- holdedJoint : GameObject
|
||||
- isJointOccupied : bool = false
|
||||
- CanAccept(otherSocket:ISocket) : bool
|
||||
+ CanAccept(otherSocket:ISocket, isJoint:bool) : bool
|
||||
+ GetNormal() : Vector3
|
||||
+ Highlight(state:HighlightState) : void
|
||||
- Update() : void
|
||||
+ GetTransform() : Transform
|
||||
+ GetSocketType() : SocketType
|
||||
+ GetSocketRadius() : float
|
||||
+ SetSocketRadius(radius:float) : void
|
||||
+ IsOccupied() : bool
|
||||
+ IsJointOccupied() : bool
|
||||
+ GetOccupyingObject() : GameObject
|
||||
+ GetJointObject() : GameObject
|
||||
+ SetOccupied(obj:GameObject) : void
|
||||
+ SetJointOccupied(jointObject:GameObject) : void
|
||||
+ ReleaseJoint() : void
|
||||
+ Release() : void
|
||||
}
|
||||
enum HighlightState {
|
||||
Default,
|
||||
Active,
|
||||
Compatible,
|
||||
Incompatible,
|
||||
}
|
||||
MonoBehaviour <|-- SocketPoint
|
||||
ISocket <|-- SocketPoint
|
||||
@enduml
|
||||
Reference in New Issue
Block a user