Initial commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using UnityEngine;
|
||||
|
||||
public struct GhostMovementContext
|
||||
{
|
||||
// Ghost
|
||||
public readonly Transform GhostTransform;
|
||||
|
||||
// surface
|
||||
public readonly Vector3 SurfacePoint;
|
||||
public readonly Vector3 SurfaceNormal;
|
||||
|
||||
// Socket snap
|
||||
public readonly SocketPoint MySocket;
|
||||
public readonly SocketPoint TargetSocket;
|
||||
|
||||
// Per-prefab config
|
||||
public readonly Transform AttachPoint;
|
||||
public readonly float FollowSpeed;
|
||||
public readonly float HeightOffset;
|
||||
public readonly bool AlignToSurfaceNormal;
|
||||
public readonly bool SnapRotation;
|
||||
|
||||
// Output, GhostManager reads it after the call
|
||||
public Vector3 RotationAxis;
|
||||
|
||||
public GhostMovementContext(
|
||||
Transform ghostTransform,
|
||||
Vector3 surfacePoint,
|
||||
Vector3 surfaceNormal,
|
||||
SocketPoint mySocket,
|
||||
SocketPoint targetSocket,
|
||||
Transform attachPoint,
|
||||
float followSpeed,
|
||||
float heightOffset,
|
||||
bool alignToSurfaceNormal,
|
||||
bool snapRotation)
|
||||
{
|
||||
GhostTransform = ghostTransform;
|
||||
SurfacePoint = surfacePoint;
|
||||
SurfaceNormal = surfaceNormal;
|
||||
MySocket = mySocket;
|
||||
TargetSocket = targetSocket;
|
||||
AttachPoint = attachPoint;
|
||||
FollowSpeed = followSpeed;
|
||||
HeightOffset = heightOffset;
|
||||
AlignToSurfaceNormal = alignToSurfaceNormal;
|
||||
SnapRotation = snapRotation;
|
||||
RotationAxis = Vector3.up;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c3839bd09a5f994a978d6ec4d28907e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,4 @@
|
||||
public interface IBlockValidator
|
||||
{
|
||||
bool IsValid(BlockEditContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b7bdf5f93500cc4ea122aed8590f119
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <summary>
|
||||
/// Drives how the ghost object moves and orients each frame.
|
||||
/// </summary>
|
||||
public interface IGhostMovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Called every frame when there is an active ghost.
|
||||
/// Responsible for updating GhostTransform.position and .rotation.
|
||||
/// Must also write ctx.RotationAxis before returning.
|
||||
/// </summary>
|
||||
void UpdateMovement(ref GhostMovementContext ctx);
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88109b2aac07c13428dd1bb3bbf4663a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
public interface IPlacementHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Commit the ghost's current transform as the final placed state.
|
||||
/// </summary>
|
||||
void Commit(BlockEditContext ctx);
|
||||
|
||||
/// <summary>
|
||||
/// Cancel the edit and restore any previous state.
|
||||
/// </summary>
|
||||
void Cancel(BlockEditContext ctx);
|
||||
|
||||
void Debugln();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a79e2636d81808f4ab5c5769d6ea3057
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
public interface IRotateHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// handle rotation of Ghost Transfrom
|
||||
/// </summary>
|
||||
void performRotation(BlockEditContext ctx);
|
||||
|
||||
/// <summary>
|
||||
/// add an angle to the allowed angles to rotate with
|
||||
/// </summary>
|
||||
void addAngle(float angle);
|
||||
|
||||
/// <summary>
|
||||
/// remove that angle
|
||||
/// </summary>
|
||||
void removeAngle(float angle);
|
||||
|
||||
/// <summary>
|
||||
/// clear all added angles
|
||||
/// </summary>
|
||||
void clearAngles();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83bb80b9424f55842853a57c456c0401
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
public interface ISnapBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Called every frame after socket scanning.
|
||||
/// Returns true if a snap was applied and false if failed.
|
||||
/// </summary>
|
||||
bool TrySnap(BlockEditContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74a4d0f44a9d4224f892223405ba68cc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
public interface IVisualFeedback
|
||||
{
|
||||
void OnValid(BlockEditContext ctx);
|
||||
void OnInvalid(BlockEditContext ctx);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d02dfbcf6de3142458a6092ebae279bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user