Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
@startuml
|
||||
class AxisMoveStrategy {
|
||||
- <<readonly>> _lockedRotation : Quaternion
|
||||
- _isDragging : bool
|
||||
- _axisDirection : Vector3
|
||||
- _axisOrigin : Vector3
|
||||
- _clampMin : float
|
||||
- _clampMax : float
|
||||
- _camera : Camera
|
||||
- _frozenPosition : Vector3
|
||||
- _lastMousePos : Vector2
|
||||
- _accumulated : float
|
||||
+ AxisMoveStrategy(lockedRotation:Quaternion, clampMin:float, clampMax:float)
|
||||
+ BeginDrag(axisDirection:Vector3, ghostPosition:Vector3) : void
|
||||
+ EndDrag() : void
|
||||
+ UpdateMovement(ctx:GhostMovementContext) : void
|
||||
- TrySocketSnap(ctx:GhostMovementContext) : bool
|
||||
}
|
||||
IGhostMovementStrategy <|-- AxisMoveStrategy
|
||||
@enduml
|
||||
@@ -0,0 +1,24 @@
|
||||
@startuml
|
||||
class AxisRotateStrategy {
|
||||
+ OverridesSurfaceTracking : bool <<get>>
|
||||
- <<readonly>> _localAxis : LocalAxis
|
||||
- <<readonly>> _lockedPosition : Vector3
|
||||
- _isRotating : bool
|
||||
- _pendingDegrees : float
|
||||
- _lastMousePos : Vector2
|
||||
+ Sensitivity : float = 0.4f
|
||||
+ AxisRotateStrategy(localAxis:LocalAxis, lockedPosition:Vector3)
|
||||
+ BeginRotate() : void
|
||||
+ EndRotate() : void
|
||||
+ UpdateMovement(ctx:GhostMovementContext) : void
|
||||
- GetWorldAxis(t:Transform) : Vector3
|
||||
- {static} SnapToNearestRightAngle(q:Quaternion) : Quaternion
|
||||
}
|
||||
enum LocalAxis {
|
||||
Up,
|
||||
Forward,
|
||||
Right,
|
||||
}
|
||||
IGhostMovementStrategy <|-- AxisRotateStrategy
|
||||
AxisRotateStrategy +-- LocalAxis
|
||||
@enduml
|
||||
@@ -0,0 +1,12 @@
|
||||
@startuml
|
||||
class FreeMoveStrategy {
|
||||
+ UpdateMovement(ctx:GhostMovementContext) : void
|
||||
- {static} TrySocketSnap(ctx:GhostMovementContext) : bool
|
||||
- {static} PerformSocketSnap(ctx:GhostMovementContext) : void
|
||||
- {static} AlignToSurfaceNormal(ctx:GhostMovementContext) : void
|
||||
- {static} MoveAlongSurface(ctx:GhostMovementContext) : void
|
||||
- {static} GetCurrentPivot(ctx:GhostMovementContext) : Transform
|
||||
- {static} SnapToNearestRightAngle(q:Quaternion) : Quaternion
|
||||
}
|
||||
IGhostMovementStrategy <|-- FreeMoveStrategy
|
||||
@enduml
|
||||
@@ -0,0 +1,16 @@
|
||||
@startuml
|
||||
struct GhostMovementContext {
|
||||
+ <<readonly>> GhostTransform : Transform
|
||||
+ <<readonly>> SurfacePoint : Vector3
|
||||
+ <<readonly>> SurfaceNormal : Vector3
|
||||
+ <<readonly>> MySocket : SocketPoint
|
||||
+ <<readonly>> TargetSocket : SocketPoint
|
||||
+ <<readonly>> AttachPoint : Transform
|
||||
+ <<readonly>> FollowSpeed : float
|
||||
+ <<readonly>> HeightOffset : float
|
||||
+ <<readonly>> AlignToSurfaceNormal : bool
|
||||
+ <<readonly>> SnapRotation : bool
|
||||
+ RotationAxis : Vector3
|
||||
+ GhostMovementContext(ghostTransform:Transform, surfacePoint:Vector3, surfaceNormal:Vector3, mySocket:SocketPoint, targetSocket:SocketPoint, attachPoint:Transform, followSpeed:float, heightOffset:float, alignToSurfaceNormal:bool, snapRotation:bool)
|
||||
}
|
||||
@enduml
|
||||
@@ -0,0 +1,18 @@
|
||||
@startuml
|
||||
class GhostStrategyHandler {
|
||||
- {static} instance : GhostStrategyHandler
|
||||
+ {static} getInstance() : GhostStrategyHandler
|
||||
- ghostManager : GhostManager
|
||||
- Awake() : void
|
||||
- Start() : void
|
||||
+ StartDraggingRight() : void
|
||||
+ StartDraggingUp() : void
|
||||
+ StartDraggingForward() : void
|
||||
+ EndDragging() : void
|
||||
+ StartRotatingRight() : AxisRotateStrategy
|
||||
+ StartRotatingUp() : AxisRotateStrategy
|
||||
+ StartRotatingForward() : AxisRotateStrategy
|
||||
+ StartRotation() : void
|
||||
}
|
||||
MonoBehaviour <|-- GhostStrategyHandler
|
||||
@enduml
|
||||
@@ -0,0 +1,41 @@
|
||||
@startuml
|
||||
class GhostStrategyTester {
|
||||
+ TestTarget : GameObject
|
||||
+ ClampMin : float
|
||||
+ ClampMax : float = 5f
|
||||
+ RotateSensitivity : float = 0.4f
|
||||
- _mode : Mode
|
||||
- _moveStrat : AxisMoveStrategy
|
||||
- _rotStrat : AxisRotateStrategy
|
||||
- _isEditing : bool
|
||||
- _buttonHeld : bool
|
||||
- _activeAxisIndex : int
|
||||
- _lastMouseX : float
|
||||
- _editingOrigin : Vector3
|
||||
- {static} <<readonly>> AxisColors : Color[]
|
||||
- {static} <<readonly>> AxisLabels : string[]
|
||||
- {static} <<readonly>> LocalMoveAxes : Vector3[]
|
||||
- {static} <<readonly>> RotateAxes : AxisRotateStrategy.LocalAxis[]
|
||||
- <<const>> BtnW : float = 96f
|
||||
- <<const>> BtnH : float = 36f
|
||||
- <<const>> PadX : float = 12f
|
||||
- <<const>> PadY : float = 8f
|
||||
- Start() : void
|
||||
- OnGUI() : void
|
||||
- DrawAxisButton(i:int, rect:Rect) : void
|
||||
- OnAxisButtonDown(axisIndex:int) : void
|
||||
- OnAxisButtonUp() : void
|
||||
- EnsureEditing() : void
|
||||
- CommitEdit() : void
|
||||
- StopEditing() : void
|
||||
- ResetState() : void
|
||||
- DrawModeButton(label:string, target:Mode, rect:Rect) : void
|
||||
}
|
||||
enum Mode {
|
||||
None,
|
||||
AxisMove,
|
||||
AxisRotate,
|
||||
}
|
||||
MonoBehaviour <|-- GhostStrategyTester
|
||||
GhostStrategyTester +-- Mode
|
||||
@enduml
|
||||
@@ -0,0 +1,5 @@
|
||||
@startuml
|
||||
interface IGhostMovementStrategy {
|
||||
UpdateMovement(ctx:GhostMovementContext) : void
|
||||
}
|
||||
@enduml
|
||||
Reference in New Issue
Block a user