Initial commit

This commit is contained in:
HussienX72u
2026-07-21 08:56:10 +03:00
commit 4017028111
9410 changed files with 2150500 additions and 0 deletions
@@ -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
@@ -0,0 +1,72 @@
@startuml
class GhostManager {
- {static} instance : GhostManager
+ {static} getInstance() : GhostManager
- selectedBlockData : BlockData
- ghostObject : GameObject
- canPlace : bool = false
- onClearEvent : UnityEvent
- alignToSurfaceNormal : bool = true
- snapRotation : bool = false
- followSpeed : float = 20f
- heightOffset : float = 0f
- validTint : Color
- invalidTint : Color
- attachPoint : Transform
- validator : IValidator
- isValidPlacement : bool = true
- currentSurfaceNormal : Vector3
- currentSurfacePoint : Vector3
- rotationAxis : Vector3
- ghostRenderers : Renderer[]
- container : SocketContainer
- jointBlock : JointBlock
- block : Block
- isDragged : bool = false
- isJustPlaced : bool = false
- editingSourceObject : GameObject
- editingOriginalPos : Vector3
- editingOriginalRot : Quaternion
- isEditingExisting : bool
- currentStrategy : IGhostMovementStrategy
+ SetMovementStrategy(strategy:IGhostMovementStrategy) : void
- rayInteractor : RayInteractor
- snappingSystem : SnapSystem
- environment : Environment
- commandHandler : CommandHandler
- socketIterator : SocketIterator
- inputProvider : BaseInputProvider
- Awake() : void
- Start() : void
- Update() : void
+ GhostTransform : Transform <<get>>
+ setDrag(drag:bool) : void
- OnPlace() : void
+ ForcePlace() : void
- resetPlaced() : IEnumerator
- OnPlaceWithDragging() : void
- PlaceBlock() : void
- CommitExistingBlock() : void
+ SetupBlock(blockData:BlockData) : void
+ SetupExistingBlock(sourceObject:GameObject, strategy:IGhostMovementStrategy) : void
- InitialiseGhostFromObject(ghost:GameObject) : void
+ HasActiveGhost() : bool
+ isGhost(obj:GameObject) : bool
+ ClearGhost() : void
+ ClearGhostData() : void
- UpdateSurfaceTracking() : void
- UpdateVisualFeedback(isValid:bool) : void
- {static} SetLayerRecursively(obj:GameObject, layer:int, Method:Func<Transform, bool>) : void
- {static} SetLayerRecursively(obj:GameObject, layer:int) : void
- {static} RestoreMaterialAlpha(obj:GameObject, Method:Func<GameObject, bool>) : void
- {static} RestoreMaterialAlpha(obj:GameObject) : void
- {static} RestoreMaterialColor(obj:GameObject, Method:Func<GameObject, bool>) : void
- {static} RestoreMaterialColor(obj:GameObject) : void
+ onClearAddListener(action:UnityAction) : void
+ setupBlock(blockData:BlockData) : void
+ clearGhost() : void
+ clearGhostData() : void
- afterCreation(blockObj:GameObject) : void
}
MonoBehaviour <|-- GhostManager
@enduml
@@ -0,0 +1,14 @@
@startuml
class InteractionManager {
- {static} instance : InteractionManager
- commandHandler : CommandHandler
- ghostManager : GhostManager
- selectionManager : SelectionManager
- uiManager : UIManager
- Awake() : void
+ {static} getInstance() : InteractionManager
- Start() : void
- setupListeners() : void
}
MonoBehaviour <|-- InteractionManager
@enduml
@@ -0,0 +1,18 @@
@startuml
class SelectionManager {
- {static} instance : SelectionManager
+ {static} getInstance() : SelectionManager
- rayInteractor : RayInteractor
- inputProvider : BaseInputProvider
- <<readonly>> currentSelections : List<IInteractable>
- multiSelectEnabled : bool = false
+ SelectionEvent : UnityEvent<IInteractable>
- Awake() : void
- Start() : void
- HandleSelect(interactable:IInteractable) : void
+ GetCurrentSelections() : List<IInteractable>
+ ClearSelection() : void
+ HasOneSelection() : bool
}
MonoBehaviour <|-- SelectionManager
@enduml
@@ -0,0 +1,18 @@
@startuml
class SocketManagerChecker {
- environment : Environment
- ghostManager : GhostManager
- rayInteractor : RayInteractor
- jointPlacementHandler : JointPlacementHandler
- socketTolerance : float = 0.5f
- Start() : void
- OnRemove(arg0:Block) : void
- OnAdd(arg0:Block) : void
- OnBlockRemoved(arg0:Block) : void
- OnJointRemoved(arg0:Block) : void
- OnBlockAdded(arg0:Block) : void
- OnJointAdded(arg0:Block) : void
- getClosestSocketBy(socketPoint:SocketPoint, tol:float) : SocketPoint
}
MonoBehaviour <|-- SocketManagerChecker
@enduml
@@ -0,0 +1,14 @@
@startuml
class UIManager {
- {static} instance : UIManager
- currentSelectedUIInteractable : UIInteractable
- currentSelectedData : BlockData
+ onSelectEvent : UnityEvent<BlockData>
- currentCategory : CategoryData
- Awake() : void
+ {static} getInstance() : UIManager
+ selectUIInteractable(uiInteractable:UIInteractable) : void
+ deselectUIInteractable() : void
}
MonoBehaviour <|-- UIManager
@enduml