From 9374d29fa465940ac181a8ffffcfd1342f5f2f65 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 6 Oct 2023 12:22:06 +0200 Subject: [PATCH 01/87] readd some tilehelper methods --- .../Systems/Tile/PlacedObjects/PlacedTileObject.cs | 4 +++- Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs | 13 ++++++++++++- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 1ae71aff26..a89f7b3e4b 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -1,4 +1,4 @@ -using FishNet; +using FishNet; using FishNet.Object; using SS3D.Core; using SS3D.Logging; @@ -71,6 +71,8 @@ public static PlacedTileObject Create(Vector3 worldPosition, Vector2Int origin, public TileObjectSpecificType SpecificType => _tileObjectSo.specificType; + public Direction Direction => _dir; + public string NameString => _tileObjectSo.nameString; public bool HasAdjacencyConnector => _connector != null; diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index 5b8c62de96..c9635ec820 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -51,6 +51,17 @@ public static Vector3 GetClosestPosition(Vector3 worldPosition) return new Vector3(Mathf.Round(worldPosition.x), 0, Mathf.Round(worldPosition.z)); } + public static Direction GetRelativeDirection(Direction to, Direction from) + { + return (Direction)((((int)to - (int)from) + 8) % 8); + } + + public static int GetDirectionIndex(Direction dir) + { + return (int)dir / 2; + } + + public static List CardinalDirections() { return new List { Direction.North, Direction.East, Direction.South, Direction.West }; diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index c6f81f9ee2..619fd8e8a7 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -1,4 +1,4 @@ -using FishNet; +using FishNet; using FishNet.Object; using JetBrains.Annotations; using SS3D.Core; @@ -123,7 +123,7 @@ private TileObject[] GetTileObjects(Vector3 worldPosition) return tileObjects; } - private PlacedTileObject[] GetNeighbourPlacedObjects(TileLayer layer, Vector3 worldPosition) + public PlacedTileObject[] GetNeighbourPlacedObjects(TileLayer layer, Vector3 worldPosition) { PlacedTileObject[] adjacentObjects = new PlacedTileObject[8]; From a2ed930a004d03d7721523ba6a8bd9500e385059 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 6 Oct 2023 12:22:26 +0200 Subject: [PATCH 02/87] readd door --- .../SS3D/Systems/Tile/Connections/Door.cs | 215 ++++++++++++++++++ .../Systems/Tile/Connections/Door.cs.meta | 11 + 2 files changed, 226 insertions(+) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs new file mode 100644 index 0000000000..4390909335 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs @@ -0,0 +1,215 @@ + +using UnityEngine; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using Coimbra; + +namespace SS3D.Systems.Tile.Connections +{ + public class Door : MonoBehaviour, IAdjacencyConnector + { + public enum DoorType + { + Single, + Double + }; + + /** Based on peculiarities of the model, the appropriate position of the wall cap */ + private const float WALL_CAP_DISTANCE_FROM_CENTRE = 0f; + + // As is the standard in the rest of the code, wallCap should face east. + [SerializeField] + private GameObject wallCapPrefab = null; + + [SerializeField] + private DoorType doorType; + + private TileMap map; + private PlacedTileObject placedTileObject; + + public void CleanAdjacencies() + { + if (!map) + { + map = GetComponentInParent(); + } + + SetPerpendicularBlocked(false); + + var neighbourObjects = map.GetNeighbourPlacedObjects(TileLayer.Turf, transform.position); + for (int i = 0; i < neighbourObjects.Length; i++) + { + neighbourObjects[i]?.UpdateSingleAdjacency(placedTileObject, + TileHelper.GetOpposite((Direction)i)); + } + } + + public bool UpdateSingle(Direction direction, PlacedTileObject placedObject, bool updateNeighbours) + { + + if (UpdateSingleConnection(direction, placedObject)) + UpdateWallCaps(); + + // TODO should check if connection was actually updated. + return true; + } + + public void UpdateAll(PlacedTileObject[] neighbourObjects) + { + // Because we are on a Furniture layer and walls are on the Turf. Discard furniture neighbours and get the turf neighbours. + if (!map) + map = GetComponentInParent(); + + neighbourObjects = map.GetNeighbourPlacedObjects(TileLayer.Turf, transform.position); + PlacedTileObject currentObject = GetComponent(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + bool updatedSingle = false; + updatedSingle = UpdateSingleConnection((Direction)i, neighbourObjects[i]); + if (updatedSingle && neighbourObjects[i]) + neighbourObjects[i].UpdateSingleAdjacency(currentObject, TileHelper.GetOpposite((Direction)i)); + + changed |= updatedSingle; + } + + if (changed) + { + UpdateWallCaps(); + } + } + + /** + * Adjusts the connections value based on the given new tile. + * Returns whether value changed. + */ + private bool UpdateSingleConnection(Direction direction, PlacedTileObject placedObject) + { + SetPerpendicularBlocked(true); + bool isConnected = (placedObject && placedObject.HasAdjacencyConnector && + placedObject.GenericType == TileObjectGenericType.Wall); + + return adjacencyMap.SetConnection(direction, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + } + + /// + /// Walls will try to connect to us. Block or unblock that connects if we are not facing the wall + /// + private void SetPerpendicularBlocked(bool isBlocked) + { + // Door can have rotated in the time between + Direction doorDirection = GetDoorDirection(); + if (map == null) + return; + // map = GetComponentInParent(); + + var neighbourObjects = map.GetNeighbourPlacedObjects(TileLayer.Turf, transform.position); + Direction opposite = TileHelper.GetOpposite(doorDirection); + + MultiAdjacencyConnector wallConnector = null; + if (neighbourObjects[(int)doorDirection] != null) + wallConnector = neighbourObjects[(int)doorDirection].GetComponent(); + + if (wallConnector) + wallConnector.SetBlockedDirection(opposite, isBlocked); + + // Opposite side of door + wallConnector = null; + if (neighbourObjects[(int)opposite] != null) + wallConnector = neighbourObjects[(int)opposite].GetComponent(); + + if (wallConnector) + wallConnector.SetBlockedDirection(doorDirection, isBlocked); + } + + private void CreateWallCaps(bool isPresent, Direction direction) + { + int capIndex = TileHelper.GetDirectionIndex(direction); + if (isPresent && wallCaps[capIndex] == null) + { + + wallCaps[capIndex] = SpawnWallCap(direction); + wallCaps[capIndex].name = $"WallCap{capIndex}"; + } + else if (!isPresent && wallCaps[capIndex] != null) + { + wallCaps[capIndex].Dispose(true); + wallCaps[capIndex] = null; + } + } + + private void UpdateWallCaps() + { + if (wallCapPrefab == null) + return; + + // Door may have rotated in the editor + Direction outFacing = TileHelper.GetNextDir(GetDoorDirection()); + + bool isPresent = adjacencyMap.HasConnection(outFacing); + CreateWallCaps(isPresent, TileHelper.GetOpposite(outFacing)); + + isPresent = adjacencyMap.HasConnection(TileHelper.GetOpposite(outFacing)); + CreateWallCaps(isPresent, outFacing); + } + + private void ValidateChildren() + { + // Note: This only needs to run on the server, which loads from the scene. + // Anywhere else (including clients, mostly), doesn't really need this. + for (int i = transform.childCount - 1; i > 0; --i) + { + var child = transform.GetChild(i); + if (child.name.StartsWith("WallCap")) + { + bool success = int.TryParse(child.name.Substring(7), out int num); + + // Remove if no int, int out of bounds, or duplicate + if (!success || num > wallCaps.Length || num < 0 || (wallCaps[num] != null && !ReferenceEquals(wallCaps[num], child.gameObject))) + { + Debug.LogWarning($"Unusual child found whilst searching for wall caps: {child.name}, deleting"); + child.gameObject.Dispose(true); + continue; + } + + wallCaps[num] = child.gameObject; + } + } + } + + /** + * Spawns a wall cap facing a direction, with appropriate position & settings + * Direction from the centre of the door + */ + private GameObject SpawnWallCap(Direction direction) + { + var wallCap = Instantiate(wallCapPrefab, transform); + Direction doorDirection = GetDoorDirection(); + + Direction cardinalDirectionInput = TileHelper.GetRelativeDirection(direction, doorDirection); + var cardinal = TileHelper.ToCardinalVector(cardinalDirectionInput); + float rotation = TileHelper.AngleBetween(direction, doorDirection); + + + wallCap.transform.localRotation = Quaternion.Euler(0, rotation, 0); + wallCap.transform.localPosition = new Vector3(cardinal.Item1 * WALL_CAP_DISTANCE_FROM_CENTRE, 0, cardinal.Item2 * WALL_CAP_DISTANCE_FROM_CENTRE); + + return wallCap; + } + + private Direction GetDoorDirection() + { + if (placedTileObject == null) + { + placedTileObject = GetComponent(); + } + + return placedTileObject.Direction; + } + + // WallCap gameobjects, North, East, South, West. Null if not present. + private GameObject[] wallCaps = new GameObject[4]; + private AdjacencyMap adjacencyMap = new AdjacencyMap(); + } + +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs.meta new file mode 100644 index 0000000000..668ebbf8da --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d00d6a1b2cb9fb54fbefde21a9eb88a4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 98f6d2fa1bd818d42b54507f025f1cacf36bdeeb Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 6 Oct 2023 19:23:37 +0200 Subject: [PATCH 03/87] add simple adjacency --- .../Pipes/Disposals/DisposalPipes.prefab | 53 ++----- .../Connections/SimpleAdjacencyConnector.cs | 139 ++++++++++++++++++ .../SimpleAdjacencyConnector.cs.meta | 11 ++ 3 files changed, 164 insertions(+), 39 deletions(-) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs.meta diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab index 883ac32b85..0a8443be41 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: -7727686409064562107} - component: {fileID: -1074477776341974781} - component: {fileID: -4998431523760016775} - - component: {fileID: 31680455597932218} + - component: {fileID: 1729570281371340860} m_Layer: 0 m_Name: DisposalPipes m_TagString: Untagged @@ -49,19 +49,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: - - {fileID: 31680455597932218} + - {fileID: 1729570281371340860} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 107 + k__BackingField: 166 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 18330170179948219730 - _sceneNetworkObjects: [] --- !u!33 &-1074477776341974781 MeshFilter: m_ObjectHideFlags: 0 @@ -112,7 +118,7 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &31680455597932218 +--- !u!114 &1729570281371340860 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -121,13 +127,14 @@ MonoBehaviour: m_GameObject: {fileID: 2802364579275783218} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: bc6615260753fbd48af09343d5d55332, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 0 _addedNetworkObject: {fileID: -7727686409064562107} _networkObjectCache: {fileID: -7727686409064562107} - SelectedAdjacencyType: 0 + _genericType: 1 + _specificType: 0 _simpleAdjacency: o: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} u: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} @@ -135,36 +142,4 @@ MonoBehaviour: l: {fileID: -7002929985465626668, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} t: {fileID: 7767200051770316982, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} x: {fileID: -7993494061914831054, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} - _advancedAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - lNone: {fileID: 0} - lSingle: {fileID: 0} - tNone: {fileID: 0} - tSingleRight: {fileID: 0} - tSingleLeft: {fileID: 0} - tDouble: {fileID: 0} - xNone: {fileID: 0} - xSingle: {fileID: 0} - xSide: {fileID: 0} - xOpposite: {fileID: 0} - xTriple: {fileID: 0} - xQuad: {fileID: 0} - viewObstacles: [] - opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} _syncedConnections: 0 diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs new file mode 100644 index 0000000000..73a8cec576 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs @@ -0,0 +1,139 @@ +using FishNet.Object; +using FishNet.Object.Synchronizing; +using SS3D.Logging; +using SS3D.Systems.Tile; +using SS3D.Systems.Tile.Connections; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +/// +/// Good for stuff that connects on the same layer only, horizontally, of the same specific and generic type. +/// +public class SimpleAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector +{ + /// + /// A type that specifies to which objects to connect to. Must be set if cross connect is used. + /// + [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] + [SerializeField] + private TileObjectGenericType _genericType; + + /// + /// Specific ID to differentiate objects when the generic is the same. + /// + [Tooltip("Specific ID to differentiate objects when the generic is the same.")] + [SerializeField] + private TileObjectSpecificType _specificType; + + [SerializeField] private SimpleConnector _simpleAdjacency; + + [SyncVar(OnChange = nameof(SyncAdjacencies))] + private byte _syncedConnections; + + private AdjacencyMap _adjacencyMap; + private MeshFilter _filter; + private bool _initialized; + private PlacedTileObject _placedObject; + + public override void OnStartClient() + { + base.OnStartClient(); + Setup(); + } + + private void Setup() + { + if (!_initialized) + { + _adjacencyMap = new AdjacencyMap(); + _filter = GetComponent(); + + _placedObject = GetComponent(); + if (_placedObject == null) + { + _genericType = TileObjectGenericType.None; + _specificType = TileObjectSpecificType.None; + } + else + { + _genericType = _placedObject.GenericType; + _specificType = _placedObject.SpecificType; + } + _initialized = true; + } + } + + private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) + { + if (!asServer) + { + Setup(); + + _adjacencyMap.DeserializeFromByte(newValue); + UpdateMeshAndDirection(); + } + } + + public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + { + bool isConnected = false; + + if (neighbourObject != null) + { + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; + isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; + + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + } + + bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + + if (isUpdated) + { + _syncedConnections = _adjacencyMap.SerializeToByte(); + UpdateMeshAndDirection(); + } + + return isUpdated; + } + + private void UpdateMeshAndDirection() + { + MeshDirectionInfo info = new(); + info = _simpleAdjacency.GetMeshAndDirection(_adjacencyMap); + + if (_filter == null) + { + Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + } + + _filter.mesh = info.Mesh; + + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); + + transform.localRotation = localRotation; + } + + public void UpdateAll(PlacedTileObject[] neighbourObjects) + { + Setup(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + } + + if (changed) + { + UpdateMeshAndDirection(); + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs.meta new file mode 100644 index 0000000000..bb92f1ded0 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc6615260753fbd48af09343d5d55332 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 373abd0a081ce88db349a4c029ee84ed0f2e0d0b Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 6 Oct 2023 19:35:06 +0200 Subject: [PATCH 04/87] add advanced connector --- .../Floors/Tiles/Carpet/FancyCarpetRed.prefab | 43 ++-- .../Connections/AdvancedAdjacencyConnector.cs | 150 +++++++++++++ .../AdvancedAdjacencyConnector.cs.meta | 11 + .../Connections/SimpleAdjacencyConnector.cs | 199 +++++++++--------- 4 files changed, 277 insertions(+), 126 deletions(-) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs.meta diff --git a/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab b/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab index 44ff81eb00..56a86f96c9 100644 --- a/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab +++ b/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 6696866361892651655} - component: {fileID: 37166840573251760} - component: {fileID: 6999522401175031449} - - component: {fileID: -2329561759450310542} + - component: {fileID: 3040907911380660968} m_Layer: 0 m_Name: FancyCarpetRed m_TagString: Untagged @@ -113,19 +113,26 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: [] + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: 0} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 4511097998240534661 - _sceneNetworkObjects: [] ---- !u!114 &-2329561759450310542 +--- !u!114 &3040907911380660968 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -134,20 +141,14 @@ MonoBehaviour: m_GameObject: {fileID: 3591147544166670882} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 255 _addedNetworkObject: {fileID: 6999522401175031449} _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} + _genericType: 9 + _specificType: 5 _advancedAdjacency: o: {fileID: 6313828114514605112, guid: 672e6a3c2617a374084ca41ab0f3b39d, type: 3} u: {fileID: 1428770310312528737, guid: 672e6a3c2617a374084ca41ab0f3b39d, type: 3} @@ -166,18 +167,4 @@ MonoBehaviour: xQuad: {fileID: 9022132694264211953, guid: 672e6a3c2617a374084ca41ab0f3b39d, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} _syncedConnections: 0 diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs new file mode 100644 index 0000000000..8d22fa29b3 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs @@ -0,0 +1,150 @@ +using FishNet.Object; +using FishNet.Object.Synchronizing; +using SS3D.Logging; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Serialization; + +namespace SS3D.Systems.Tile.Connections +{ + public class AdvancedAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector + { + /// + /// A type that specifies to which objects to connect to. Must be set if cross connect is used. + /// + [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] + [SerializeField] + private TileObjectGenericType _genericType; + + /// + /// Specific ID to differentiate objects when the generic is the same. + /// + [Tooltip("Specific ID to differentiate objects when the generic is the same.")] + [SerializeField] + private TileObjectSpecificType _specificType; + + [FormerlySerializedAs("advancedAdjacency")][SerializeField] private AdvancedConnector _advancedAdjacency; + + private AdjacencyMap _adjacencyMap; + + [SyncVar(OnChange = nameof(SyncAdjacencies))] + private byte _syncedConnections; + + private MeshFilter _filter; + private bool _initialized; + private PlacedTileObject _placedObject; + + public override void OnStartClient() + { + base.OnStartClient(); + Setup(); + } + + private void Setup() + { + if (!_initialized) + { + _adjacencyMap = new AdjacencyMap(); + _filter = GetComponent(); + + _placedObject = GetComponent(); + if (_placedObject == null) + { + _genericType = TileObjectGenericType.None; + _specificType = TileObjectSpecificType.None; + } + else + { + _genericType = _placedObject.GenericType; + _specificType = _placedObject.SpecificType; + } + _initialized = true; + } + } + + public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + { + bool isConnected = false; + bool isUpdated = false; + + if (neighbourObject) + { + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; + isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; + + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + } + + isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + if (isUpdated) + { + _syncedConnections = _adjacencyMap.SerializeToByte(); + UpdateMeshAndDirection(); + } + + return isUpdated; + } + + public void UpdateAll(PlacedTileObject[] neighbourObjects) + { + Setup(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + } + + if (changed) + { + UpdateMeshAndDirection(); + } + } + + private void UpdateMeshAndDirection() + { + MeshDirectionInfo info = new(); + info = _advancedAdjacency.GetMeshAndDirection(_adjacencyMap); + + if (_filter == null) + { + Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + } + + _filter.mesh = info.Mesh; + + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); + + transform.localRotation = localRotation; + } + + private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) + { + if (!asServer) + { + Setup(); + + _adjacencyMap.DeserializeFromByte(newValue); + UpdateMeshAndDirection(); + } + } + + /// + /// Sets a given direction blocked. This means that it will no longer be allowed to connect on that direction. + /// + /// + /// + public void SetBlockedDirection(Direction dir, bool value) + { + _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); + UpdateMeshAndDirection(); + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs.meta new file mode 100644 index 0000000000..4234aecc6d --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef4340642b9b436498fe733f9329ac87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs index 73a8cec576..7695dc4438 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs @@ -8,132 +8,135 @@ using System.Collections.Generic; using UnityEngine; -/// -/// Good for stuff that connects on the same layer only, horizontally, of the same specific and generic type. -/// -public class SimpleAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector +namespace SS3D.Systems.Tile.Connections { /// - /// A type that specifies to which objects to connect to. Must be set if cross connect is used. + /// Good for stuff that connects on the same layer only, horizontally, of the same specific and generic type. /// - [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] - [SerializeField] - private TileObjectGenericType _genericType; - - /// - /// Specific ID to differentiate objects when the generic is the same. - /// - [Tooltip("Specific ID to differentiate objects when the generic is the same.")] - [SerializeField] - private TileObjectSpecificType _specificType; - - [SerializeField] private SimpleConnector _simpleAdjacency; - - [SyncVar(OnChange = nameof(SyncAdjacencies))] - private byte _syncedConnections; - - private AdjacencyMap _adjacencyMap; - private MeshFilter _filter; - private bool _initialized; - private PlacedTileObject _placedObject; - - public override void OnStartClient() - { - base.OnStartClient(); - Setup(); - } - - private void Setup() + public class SimpleAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector { - if (!_initialized) + /// + /// A type that specifies to which objects to connect to. Must be set if cross connect is used. + /// + [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] + [SerializeField] + private TileObjectGenericType _genericType; + + /// + /// Specific ID to differentiate objects when the generic is the same. + /// + [Tooltip("Specific ID to differentiate objects when the generic is the same.")] + [SerializeField] + private TileObjectSpecificType _specificType; + + [SerializeField] private SimpleConnector _simpleAdjacency; + + [SyncVar(OnChange = nameof(SyncAdjacencies))] + private byte _syncedConnections; + + private AdjacencyMap _adjacencyMap; + private MeshFilter _filter; + private bool _initialized; + private PlacedTileObject _placedObject; + + public override void OnStartClient() { - _adjacencyMap = new AdjacencyMap(); - _filter = GetComponent(); + base.OnStartClient(); + Setup(); + } - _placedObject = GetComponent(); - if (_placedObject == null) - { - _genericType = TileObjectGenericType.None; - _specificType = TileObjectSpecificType.None; - } - else + private void Setup() + { + if (!_initialized) { - _genericType = _placedObject.GenericType; - _specificType = _placedObject.SpecificType; + _adjacencyMap = new AdjacencyMap(); + _filter = GetComponent(); + + _placedObject = GetComponent(); + if (_placedObject == null) + { + _genericType = TileObjectGenericType.None; + _specificType = TileObjectSpecificType.None; + } + else + { + _genericType = _placedObject.GenericType; + _specificType = _placedObject.SpecificType; + } + _initialized = true; } - _initialized = true; } - } - private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) - { - if (!asServer) + private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) { - Setup(); + if (!asServer) + { + Setup(); - _adjacencyMap.DeserializeFromByte(newValue); - UpdateMeshAndDirection(); + _adjacencyMap.DeserializeFromByte(newValue); + UpdateMeshAndDirection(); + } } - } - - public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) - { - bool isConnected = false; - if (neighbourObject != null) + public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { - isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); - isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; - isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; + bool isConnected = false; - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); - } + if (neighbourObject != null) + { + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; + isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; - bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + } - if (isUpdated) - { - _syncedConnections = _adjacencyMap.SerializeToByte(); - UpdateMeshAndDirection(); - } + bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - return isUpdated; - } + if (isUpdated) + { + _syncedConnections = _adjacencyMap.SerializeToByte(); + UpdateMeshAndDirection(); + } - private void UpdateMeshAndDirection() - { - MeshDirectionInfo info = new(); - info = _simpleAdjacency.GetMeshAndDirection(_adjacencyMap); - - if (_filter == null) - { - Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + return isUpdated; } - _filter.mesh = info.Mesh; + private void UpdateMeshAndDirection() + { + MeshDirectionInfo info = new(); + info = _simpleAdjacency.GetMeshAndDirection(_adjacencyMap); - Quaternion localRotation = transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); + if (_filter == null) + { + Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + } - transform.localRotation = localRotation; - } + _filter.mesh = info.Mesh; - public void UpdateAll(PlacedTileObject[] neighbourObjects) - { - Setup(); + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); - bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) - { - changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + transform.localRotation = localRotation; } - if (changed) + public void UpdateAll(PlacedTileObject[] neighbourObjects) { - UpdateMeshAndDirection(); + Setup(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + } + + if (changed) + { + UpdateMeshAndDirection(); + } } } -} +} \ No newline at end of file From 501afeb0db2f5f79fb33f90547ca1fe7c26b8e27 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 6 Oct 2023 20:00:46 +0200 Subject: [PATCH 05/87] rename door script --- .../Tile/Connections/{Door.cs => DoorAdjacencyConnector.cs} | 3 ++- .../{Door.cs.meta => DoorAdjacencyConnector.cs.meta} | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename Assets/Scripts/SS3D/Systems/Tile/Connections/{Door.cs => DoorAdjacencyConnector.cs} (98%) rename Assets/Scripts/SS3D/Systems/Tile/Connections/{Door.cs.meta => DoorAdjacencyConnector.cs.meta} (100%) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs similarity index 98% rename from Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs rename to Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index 4390909335..b813095a64 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -2,10 +2,11 @@ using UnityEngine; using SS3D.Systems.Tile.Connections.AdjacencyTypes; using Coimbra; +using FishNet.Object; namespace SS3D.Systems.Tile.Connections { - public class Door : MonoBehaviour, IAdjacencyConnector + public class DoorAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector { public enum DoorType { diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Tile/Connections/Door.cs.meta rename to Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs.meta From 633cb530dd9f2353551b5ffcb8c16a00c10749b3 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 7 Oct 2023 11:56:15 +0200 Subject: [PATCH 06/87] making door connections work --- .../Structures/Walls/SteelWall.prefab | 40 ++++------ .../Connections/DoorAdjacencyConnector.cs | 73 ++----------------- .../Tile/PlacedObjects/PlacedTileObject.cs | 46 ++++++++++++ .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 64 +++++++++++++++- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 4 +- .../Scripts/SS3D/Systems/Tile/TileSystem.cs | 3 +- 6 files changed, 135 insertions(+), 95 deletions(-) diff --git a/Assets/Content/WorldObjects/Structures/Walls/SteelWall.prefab b/Assets/Content/WorldObjects/Structures/Walls/SteelWall.prefab index d8852af08a..b05da7136e 100644 --- a/Assets/Content/WorldObjects/Structures/Walls/SteelWall.prefab +++ b/Assets/Content/WorldObjects/Structures/Walls/SteelWall.prefab @@ -148,7 +148,7 @@ GameObject: - component: {fileID: 6696866361892651655} - component: {fileID: 7033236083530598125} - component: {fileID: -2900075557854325373} - - component: {fileID: 1492278076387892290} + - component: {fileID: 3395800597640737248} m_Layer: 0 m_Name: SteelWall m_TagString: Untagged @@ -253,19 +253,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 11535764229462028423 - _sceneNetworkObjects: [] ---- !u!114 &1492278076387892290 +--- !u!114 &3395800597640737248 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -274,20 +280,14 @@ MonoBehaviour: m_GameObject: {fileID: 3591147544166670882} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: d3995769f8fecf9469d1783a30e75625, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 255 _addedNetworkObject: {fileID: -2900075557854325373} _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} + _genericType: 3 + _specificType: 3 _advancedAdjacency: o: {fileID: -6490088118889457342, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} u: {fileID: -6723024526652964136, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} @@ -306,20 +306,6 @@ MonoBehaviour: xQuad: {fileID: 4199670461815796357, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} _syncedConnections: 0 --- !u!1 &7790124558541205835 GameObject: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index b813095a64..e3e653c7e7 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -25,7 +25,7 @@ public enum DoorType private DoorType doorType; private TileMap map; - private PlacedTileObject placedTileObject; + public PlacedTileObject placedTileObject; public void CleanAdjacencies() { @@ -56,7 +56,6 @@ public bool UpdateSingle(Direction direction, PlacedTileObject placedObject, boo public void UpdateAll(PlacedTileObject[] neighbourObjects) { - // Because we are on a Furniture layer and walls are on the Turf. Discard furniture neighbours and get the turf neighbours. if (!map) map = GetComponentInParent(); @@ -80,49 +79,18 @@ public void UpdateAll(PlacedTileObject[] neighbourObjects) } } - /** - * Adjusts the connections value based on the given new tile. - * Returns whether value changed. - */ + /// + /// Adjusts the connections value based on the given new tile. + /// + /// Returns whether value changed. private bool UpdateSingleConnection(Direction direction, PlacedTileObject placedObject) { - SetPerpendicularBlocked(true); bool isConnected = (placedObject && placedObject.HasAdjacencyConnector && placedObject.GenericType == TileObjectGenericType.Wall); return adjacencyMap.SetConnection(direction, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); } - /// - /// Walls will try to connect to us. Block or unblock that connects if we are not facing the wall - /// - private void SetPerpendicularBlocked(bool isBlocked) - { - // Door can have rotated in the time between - Direction doorDirection = GetDoorDirection(); - if (map == null) - return; - // map = GetComponentInParent(); - - var neighbourObjects = map.GetNeighbourPlacedObjects(TileLayer.Turf, transform.position); - Direction opposite = TileHelper.GetOpposite(doorDirection); - - MultiAdjacencyConnector wallConnector = null; - if (neighbourObjects[(int)doorDirection] != null) - wallConnector = neighbourObjects[(int)doorDirection].GetComponent(); - - if (wallConnector) - wallConnector.SetBlockedDirection(opposite, isBlocked); - - // Opposite side of door - wallConnector = null; - if (neighbourObjects[(int)opposite] != null) - wallConnector = neighbourObjects[(int)opposite].GetComponent(); - - if (wallConnector) - wallConnector.SetBlockedDirection(doorDirection, isBlocked); - } - private void CreateWallCaps(bool isPresent, Direction direction) { int capIndex = TileHelper.GetDirectionIndex(direction); @@ -144,38 +112,13 @@ private void UpdateWallCaps() if (wallCapPrefab == null) return; - // Door may have rotated in the editor Direction outFacing = TileHelper.GetNextDir(GetDoorDirection()); bool isPresent = adjacencyMap.HasConnection(outFacing); - CreateWallCaps(isPresent, TileHelper.GetOpposite(outFacing)); - - isPresent = adjacencyMap.HasConnection(TileHelper.GetOpposite(outFacing)); CreateWallCaps(isPresent, outFacing); - } - private void ValidateChildren() - { - // Note: This only needs to run on the server, which loads from the scene. - // Anywhere else (including clients, mostly), doesn't really need this. - for (int i = transform.childCount - 1; i > 0; --i) - { - var child = transform.GetChild(i); - if (child.name.StartsWith("WallCap")) - { - bool success = int.TryParse(child.name.Substring(7), out int num); - - // Remove if no int, int out of bounds, or duplicate - if (!success || num > wallCaps.Length || num < 0 || (wallCaps[num] != null && !ReferenceEquals(wallCaps[num], child.gameObject))) - { - Debug.LogWarning($"Unusual child found whilst searching for wall caps: {child.name}, deleting"); - child.gameObject.Dispose(true); - continue; - } - - wallCaps[num] = child.gameObject; - } - } + isPresent = adjacencyMap.HasConnection(TileHelper.GetOpposite(outFacing)); + CreateWallCaps(isPresent, TileHelper.GetOpposite(outFacing)); } /** @@ -194,7 +137,7 @@ private GameObject SpawnWallCap(Direction direction) wallCap.transform.localRotation = Quaternion.Euler(0, rotation, 0); wallCap.transform.localPosition = new Vector3(cardinal.Item1 * WALL_CAP_DISTANCE_FROM_CENTRE, 0, cardinal.Item2 * WALL_CAP_DISTANCE_FROM_CENTRE); - + Spawn(wallCap); return wallCap; } diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index a89f7b3e4b..af2bfa6da0 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -119,5 +119,51 @@ public SavedPlacedTileObject Save() dir = _dir, }; } + + /// + /// Is this in front of the other object ? + /// + public bool IsInFront(PlacedTileObject other) + { + if(Origin == other.Origin + TileHelper.CoordinateDifferenceInFrontFacingDirection(other.Direction)) + return true; + + return false; + } + + /// + /// Is this behind the other object ? + /// + public bool IsBehind(PlacedTileObject other) + { + if (Origin == other.Origin - TileHelper.CoordinateDifferenceInFrontFacingDirection(other.Direction)) + return true; + + return false; + } + + /// + /// Is this on the right of the other object ? + /// + public bool IsOnRight(PlacedTileObject other) + { + Direction dirOnRight = TileHelper.GetNextCardinalDir(other.Direction); + if (Origin == other.Origin + TileHelper.CoordinateDifferenceInFrontFacingDirection(dirOnRight)) + return true; + + return false; + } + + /// + /// Is this on the left of the other object ? + /// + public bool IsOnLeft(PlacedTileObject other) + { + Direction dirOnLeft = TileHelper.GetNextCardinalDir(other.Direction); + if (Origin == other.Origin - TileHelper.CoordinateDifferenceInFrontFacingDirection(dirOnLeft)) + return true; + + return false; + } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index c9635ec820..1cca7c76dc 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -1,6 +1,8 @@ -using System; +using SS3D.Logging; +using System; using System.Collections; using System.Collections.Generic; +using System.Runtime.CompilerServices; using UnityEngine; namespace SS3D.Systems.Tile @@ -24,6 +26,22 @@ public static Direction GetNextDir(Direction dir) } } + public static Direction GetNextCardinalDir(Direction dir) + { + switch (dir) + { + default: + case Direction.South: return Direction.West; + case Direction.SouthWest: return Direction.NorthWest; + case Direction.West: return Direction.North; + case Direction.NorthWest: return Direction.NorthEast; + case Direction.North: return Direction.East; + case Direction.NorthEast: return Direction.SouthEast; + case Direction.East: return Direction.South; + case Direction.SouthEast: return Direction.SouthWest; + } + } + public static int GetRotationAngle(Direction dir) { return (int)dir * 45; @@ -97,5 +115,49 @@ public static Direction GetOpposite(Direction direction) { return (Direction)(((int)direction + 4) % 8); } + + /// + /// Return the difference in coordinates for a neighbour tile in front of another one facing + /// a particular direction. + /// e.g If the original one is facing north, return (0,1), because, the tile in front of the original + /// one will be just north of the original one (hence plus one on the y axis). + /// + public static Vector2Int CoordinateDifferenceInFrontFacingDirection(Direction direction) + { + switch(direction) + { + case Direction.North: + return new Vector2Int(0, 1); + + case Direction.NorthEast: + return new Vector2Int(1, 1); + + case Direction.East: + return new Vector2Int(1, 0); + + case Direction.SouthEast: + return new Vector2Int(1, -1); + + case Direction.South: + return new Vector2Int(0, -1); + + case Direction.SouthWest: + return new Vector2Int(-1, -1); + + case Direction.West: + return new Vector2Int(-1, 0); + + case Direction.NorthWest: + return new Vector2Int(-1, 1); + + default: + Debug.LogError("direction not handled, returning (0,0)"); + return new Vector2Int(0, 0); + } + } + + + + } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index 619fd8e8a7..b28b5362c9 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -11,7 +11,9 @@ namespace SS3D.Systems.Tile { /// - /// Class used for storing and modifying a tile map. + /// Class used for storing and modifying a tile map. Coordinates on the tile map follows the following : + /// - South North is the Y axis with North going toward positives. + /// - East West is the X axis with east going toward positives. /// public class TileMap : NetworkBehaviour { diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs b/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs index 04ab4a4cf8..cc128e2510 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs @@ -1,4 +1,4 @@ -using Cysharp.Threading.Tasks; +using Cysharp.Threading.Tasks; using FishNet.Object; using SS3D.Core.Behaviours; using SS3D.Data.Management; @@ -24,6 +24,7 @@ public class TileSystem : NetworkSystem public TileResourceLoader Loader { get; private set; } private TileMap _currentMap; + public TileMap CurrentMap => _currentMap; [ServerOrClient] protected override void OnStart() From 03745812de36999c09113bfee32980677c1b6675 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 7 Oct 2023 12:11:36 +0200 Subject: [PATCH 07/87] remove wrong method --- .../SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index e3e653c7e7..f76333856c 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -34,8 +34,6 @@ public void CleanAdjacencies() map = GetComponentInParent(); } - SetPerpendicularBlocked(false); - var neighbourObjects = map.GetNeighbourPlacedObjects(TileLayer.Turf, transform.position); for (int i = 0; i < neighbourObjects.Length; i++) { From 2318831bc26114c1a4d9047bf882de4488b36bf0 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 7 Oct 2023 17:08:15 +0200 Subject: [PATCH 08/87] change a bit setup of map --- .../Connections/AdvancedAdjacencyConnector.cs | 1 + .../Connections/DoorAdjacencyConnector.cs | 30 ++++++++++++--- .../Tile/Connections/TileObjectType.cs | 5 ++- .../Tile/PlacedObjects/PlacedTileObject.cs | 2 + Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs | 21 ++++++++++- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 37 ++++++++++++++++--- .../Scripts/SS3D/Systems/Tile/TileSystem.cs | 2 +- 7 files changed, 84 insertions(+), 14 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs index 8d22fa29b3..fa74ce242d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs @@ -66,6 +66,7 @@ private void Setup() public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { + Setup(); bool isConnected = false; bool isUpdated = false; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index f76333856c..05899e16b5 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -27,6 +27,29 @@ public enum DoorType private TileMap map; public PlacedTileObject placedTileObject; + private bool _initialized = false; + + // WallCap gameobjects, North, East, South, West. Null if not present. + private GameObject[] wallCaps = new GameObject[4]; + private AdjacencyMap adjacencyMap = new AdjacencyMap(); + + public override void OnStartClient() + { + base.OnStartClient(); + Setup(); + } + + private void Setup() + { + if (!_initialized) + { + adjacencyMap = new AdjacencyMap(); + + placedTileObject = GetComponent(); + _initialized = true; + } + } + public void CleanAdjacencies() { if (!map) @@ -44,7 +67,7 @@ public void CleanAdjacencies() public bool UpdateSingle(Direction direction, PlacedTileObject placedObject, bool updateNeighbours) { - + Setup(); if (UpdateSingleConnection(direction, placedObject)) UpdateWallCaps(); @@ -54,6 +77,7 @@ public bool UpdateSingle(Direction direction, PlacedTileObject placedObject, boo public void UpdateAll(PlacedTileObject[] neighbourObjects) { + Setup(); if (!map) map = GetComponentInParent(); @@ -148,10 +172,6 @@ private Direction GetDoorDirection() return placedTileObject.Direction; } - - // WallCap gameobjects, North, East, South, West. Null if not present. - private GameObject[] wallCaps = new GameObject[4]; - private AdjacencyMap adjacencyMap = new AdjacencyMap(); } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs index 4bf9adc324..9190133b2d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -21,7 +21,8 @@ public enum TileObjectGenericType Floor, Counter, Cable, - Wire + Wire, + Door } /// diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index af2bfa6da0..6b5c4435da 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -71,6 +71,8 @@ public static PlacedTileObject Create(Vector3 worldPosition, Vector2Int origin, public TileObjectSpecificType SpecificType => _tileObjectSo.specificType; + public TileLayer Layer => _tileObjectSo.layer; + public Direction Direction => _dir; public string NameString => _tileObjectSo.nameString; diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs b/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs index 3d5113f0cc..58bd4222c1 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs @@ -1,4 +1,4 @@ -using FishNet; +using FishNet; using FishNet.Object; using SS3D.Core; using SS3D.Logging; @@ -198,5 +198,24 @@ public SavedTileChunk Save() return saveObject; } + + /// + /// Get all placed tile objects on this chunk. + /// + public List GetAllTilePlacedObjects() + { + var list = new List(); + foreach(TileGrid grid in _tileGridList) + { + foreach(TileObject obj in grid.TileObjectsGrid) + { + if(obj.PlacedObject != null) + { + list.Add(obj.PlacedObject); + } + } + } + return list; + } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index b28b5362c9..d4e8c1019b 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -23,6 +23,8 @@ public class TileMap : NetworkBehaviour public int ChunkCount => _chunks.Count; + public event EventHandler OnMapLoaded; + public static TileMap Create(string name) { GameObject mapObject = new GameObject(name); @@ -165,7 +167,8 @@ public bool CanBuild(TileObjectSo tileObjectSo, Vector3 placePosition, Direction return canBuild; } - public bool PlaceTileObject(TileObjectSo tileObjectSo, Vector3 placePosition, Direction dir, bool skipBuildCheck, bool replaceExisting) + public bool PlaceTileObject(TileObjectSo tileObjectSo, Vector3 placePosition, Direction dir, + bool skipBuildCheck, bool replaceExisting, bool skipAdjacency) { bool canBuild = CanBuild(tileObjectSo, placePosition, dir, replaceExisting); @@ -189,9 +192,12 @@ public bool PlaceTileObject(TileObjectSo tileObjectSo, Vector3 placePosition, Di chunk.GetTileObject(tileObjectSo.layer, gridPosition).PlacedObject = placedObject; } - // Handle Adjacency connectors - var neighbourTiles = GetNeighbourPlacedObjects(tileObjectSo.layer, placePosition); - placedObject.UpdateAdjacencies(neighbourTiles); + // Handle Adjacency connectors, can skip it particulary when loading the map. + if (!skipAdjacency){ + var neighbourTiles = GetNeighbourPlacedObjects(tileObjectSo.layer, placePosition); + placedObject.UpdateAdjacencies(neighbourTiles); + } + } return canBuild; @@ -314,7 +320,7 @@ public void Load([CanBeNull] SavedTileMap saveObject) Vector3 placePosition = chunk.GetWorldPosition(savedTile.x, savedTile.y); // Skipping build check here to allow loading tile objects in a non-valid order - PlaceTileObject(toBePlaced, placePosition, savedTile.placedSaveObject.dir, true, false); + PlaceTileObject(toBePlaced, placePosition, savedTile.placedSaveObject.dir, true, false, true); } } @@ -323,6 +329,27 @@ public void Load([CanBeNull] SavedTileMap saveObject) ItemObjectSo toBePlaced = (ItemObjectSo)tileSystem.GetAsset(savedItem.itemName); PlaceItemObject(savedItem.worldPosition, savedItem.rotation, toBePlaced); } + + OnMapLoaded?.Invoke(this, EventArgs.Empty); + UpdateAllAdjacencies(); + } + + /// + /// Update every adjacency of each placed tile object when the map is loaded. + /// + private void UpdateAllAdjacencies() + { + foreach(TileChunk chunk in _chunks.Values) + { + foreach(PlacedTileObject obj in chunk.GetAllTilePlacedObjects()) + { + if (obj.HasAdjacencyConnector) + { + var pos = chunk.GetWorldPosition(obj.Origin.x, obj.Origin.y); + obj.UpdateAdjacencies(GetNeighbourPlacedObjects(obj.Layer, pos)); + } + } + } } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs b/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs index cc128e2510..5913421cea 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileSystem.cs @@ -84,7 +84,7 @@ private bool PlaceObject(GenericObjectSo genericObjectSo, Vector3 placePosition, switch (genericObjectSo) { case TileObjectSo so: - return _currentMap.PlaceTileObject(so, placePosition, dir, false, replaceExisting); + return _currentMap.PlaceTileObject(so, placePosition, dir, false, replaceExisting, false); case ItemObjectSo so: _currentMap.PlaceItemObject(placePosition, Quaternion.Euler(0, TileHelper.GetRotationAngle(dir), 0), so); break; From 8e3e3e41a0aa1f2d1985f0cd6af681374207503b Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 7 Oct 2023 17:08:47 +0200 Subject: [PATCH 09/87] add wall connector --- .../Connections/WallAdjacencyConnector.cs | 172 ++++++++++++++++++ .../WallAdjacencyConnector.cs.meta | 11 ++ 2 files changed, 183 insertions(+) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs new file mode 100644 index 0000000000..b31e774f01 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs @@ -0,0 +1,172 @@ +using DG.Tweening; +using FishNet.Object; +using FishNet.Object.Synchronizing; +using SS3D.Logging; +using SS3D.Systems.Tile.Connections; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Tile.Connections +{ + public class WallAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector + { + /// + /// A type that specifies to which objects to connect to. Must be set if cross connect is used. + /// + [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] + [SerializeField] + private TileObjectGenericType _genericType; + + /// + /// Specific ID to differentiate objects when the generic is the same. + /// + [Tooltip("Specific ID to differentiate objects when the generic is the same.")] + [SerializeField] + private TileObjectSpecificType _specificType; + + [SerializeField] private AdvancedConnector _advancedAdjacency; + + private AdjacencyMap _adjacencyMap; + + [SyncVar(OnChange = nameof(SyncAdjacencies))] + private byte _syncedConnections; + + private MeshFilter _filter; + private bool _initialized; + private PlacedTileObject _placedObject; + + public override void OnStartClient() + { + base.OnStartClient(); + Setup(); + } + + private void Setup() + { + if (!_initialized) + { + _adjacencyMap = new AdjacencyMap(); + _filter = GetComponent(); + + _placedObject = GetComponent(); + if (_placedObject == null) + { + _genericType = TileObjectGenericType.None; + _specificType = TileObjectSpecificType.None; + } + else + { + _genericType = _placedObject.GenericType; + _specificType = _placedObject.SpecificType; + } + _initialized = true; + } + } + + public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + { + Setup(); + bool isConnected = false; + bool isUpdated = false; + + if (neighbourObject != null) + { + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + + isConnected &= neighbourObject.GenericType == TileObjectGenericType.Wall || + neighbourObject.GenericType == TileObjectGenericType.Door; + + if (neighbourObject.GetComponent() != null) + { + isConnected &= IsConnectedToDoor(neighbourObject); + } + + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + } + + isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + if (isUpdated) + { + _syncedConnections = _adjacencyMap.SerializeToByte(); + UpdateMeshAndDirection(); + } + + return isUpdated; + } + + public void UpdateAll(PlacedTileObject[] neighbourObjects) + { + Setup(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + } + + if (changed) + { + UpdateMeshAndDirection(); + } + } + + private void UpdateMeshAndDirection() + { + MeshDirectionInfo info = new(); + info = _advancedAdjacency.GetMeshAndDirection(_adjacencyMap); + + if (_filter == null) + { + Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + } + + _filter.mesh = info.Mesh; + + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); + + transform.localRotation = localRotation; + } + + private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) + { + if (!asServer) + { + Setup(); + + _adjacencyMap.DeserializeFromByte(newValue); + UpdateMeshAndDirection(); + } + } + + /// + /// Sets a given direction blocked. This means that it will no longer be allowed to connect on that direction. + /// + /// + /// + public void SetBlockedDirection(Direction dir, bool value) + { + _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); + UpdateMeshAndDirection(); + } + + private bool IsConnectedToDoor(PlacedTileObject neighbourObject) + { + bool isConnected = false; + var doorConnector = neighbourObject.GetComponent(); + var door = doorConnector.placedTileObject; + if (door != null) + { + if (_placedObject.IsOnLeft(door) || _placedObject.IsOnRight(door)) + return true; + } + + return false; + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs.meta new file mode 100644 index 0000000000..b459144e35 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3995769f8fecf9469d1783a30e75625 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From f19395b96ab34e3bc8dd4f7cf40abe8ba68f52ef Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 7 Oct 2023 17:57:14 +0200 Subject: [PATCH 10/87] expand interface and implement --- .../Connections/AdvancedAdjacencyConnector.cs | 35 +++++++++++-------- .../Connections/DoorAdjacencyConnector.cs | 31 ++++++++-------- .../Tile/Connections/IAdjacencyConnector.cs | 5 +-- .../Connections/SimpleAdjacencyConnector.cs | 33 ++++++++++------- .../Connections/WallAdjacencyConnector.cs | 26 +++++++++++--- .../Tile/PlacedObjects/PlacedTileObject.cs | 4 +-- 6 files changed, 80 insertions(+), 54 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs index fa74ce242d..7af9443c62 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs @@ -64,22 +64,15 @@ private void Setup() } } - public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { Setup(); - bool isConnected = false; - bool isUpdated = false; + bool isConnected = IsConnected(dir, neighbourObject); + bool isUpdated; - if (neighbourObject) - { - isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); - isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; - isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; - - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); - } + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); if (isUpdated) @@ -91,14 +84,26 @@ public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool u return isUpdated; } - public void UpdateAll(PlacedTileObject[] neighbourObjects) + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + bool isConnected = false; + if (neighbourObject) + { + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; + isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; + } + return isConnected; + } + + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { Setup(); bool changed = false; for (int i = 0; i < neighbourObjects.Length; i++) { - changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); } if (changed) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index 05899e16b5..540a0b2171 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -65,17 +65,20 @@ public void CleanAdjacencies() } } - public bool UpdateSingle(Direction direction, PlacedTileObject placedObject, bool updateNeighbours) + public bool UpdateSingleConnection(Direction direction, PlacedTileObject placedObject, bool updateNeighbours) { Setup(); - if (UpdateSingleConnection(direction, placedObject)) + + bool isConnected = IsConnected(direction, placedObject); + bool update = adjacencyMap.SetConnection(direction, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + + if (update) UpdateWallCaps(); - // TODO should check if connection was actually updated. return true; } - public void UpdateAll(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { Setup(); if (!map) @@ -88,7 +91,7 @@ public void UpdateAll(PlacedTileObject[] neighbourObjects) for (int i = 0; i < neighbourObjects.Length; i++) { bool updatedSingle = false; - updatedSingle = UpdateSingleConnection((Direction)i, neighbourObjects[i]); + updatedSingle = UpdateSingleConnection((Direction)i, neighbourObjects[i], true); if (updatedSingle && neighbourObjects[i]) neighbourObjects[i].UpdateSingleAdjacency(currentObject, TileHelper.GetOpposite((Direction)i)); @@ -101,18 +104,6 @@ public void UpdateAll(PlacedTileObject[] neighbourObjects) } } - /// - /// Adjusts the connections value based on the given new tile. - /// - /// Returns whether value changed. - private bool UpdateSingleConnection(Direction direction, PlacedTileObject placedObject) - { - bool isConnected = (placedObject && placedObject.HasAdjacencyConnector && - placedObject.GenericType == TileObjectGenericType.Wall); - - return adjacencyMap.SetConnection(direction, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - } - private void CreateWallCaps(bool isPresent, Direction direction) { int capIndex = TileHelper.GetDirectionIndex(direction); @@ -172,6 +163,12 @@ private Direction GetDoorDirection() return placedTileObject.Direction; } + + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + return (neighbourObject && neighbourObject.HasAdjacencyConnector && + neighbourObject.GenericType == TileObjectGenericType.Wall); + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs index 6087d291f4..2e98df709e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs @@ -5,7 +5,8 @@ /// public interface IAdjacencyConnector { - bool UpdateSingle(Direction direction, PlacedTileObject neighbourObject, bool updateNeighbour); - void UpdateAll(PlacedTileObject[] neighbourObjects); + bool UpdateSingleConnection(Direction direction, PlacedTileObject neighbourObject, bool updateNeighbour); + void UpdateAllConnections(PlacedTileObject[] neighbourObjects); + bool IsConnected(Direction dir, PlacedTileObject neighbourObject); } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs index 7695dc4438..8e3fb31a6d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs @@ -78,20 +78,15 @@ private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) } } - public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { - bool isConnected = false; + Setup(); - if (neighbourObject != null) - { - isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); - isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; - isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; + bool isConnected = IsConnected(dir, neighbourObject); - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); - } + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); @@ -123,14 +118,14 @@ private void UpdateMeshAndDirection() transform.localRotation = localRotation; } - public void UpdateAll(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { Setup(); bool changed = false; for (int i = 0; i < neighbourObjects.Length; i++) { - changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); } if (changed) @@ -138,5 +133,17 @@ public void UpdateAll(PlacedTileObject[] neighbourObjects) UpdateMeshAndDirection(); } } + + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + bool isConnected = false; + if (neighbourObject != null) + { + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; + isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; + } + return isConnected; + } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs index b31e774f01..2801732ee1 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs @@ -65,10 +65,10 @@ private void Setup() } } - public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { Setup(); - bool isConnected = false; + bool isConnected = IsConnected(dir, neighbourObject); bool isUpdated = false; if (neighbourObject != null) @@ -98,14 +98,14 @@ public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool u return isUpdated; } - public void UpdateAll(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { Setup(); bool changed = false; for (int i = 0; i < neighbourObjects.Length; i++) { - changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); } if (changed) @@ -157,7 +157,6 @@ public void SetBlockedDirection(Direction dir, bool value) private bool IsConnectedToDoor(PlacedTileObject neighbourObject) { - bool isConnected = false; var doorConnector = neighbourObject.GetComponent(); var door = doorConnector.placedTileObject; if (door != null) @@ -168,5 +167,22 @@ private bool IsConnectedToDoor(PlacedTileObject neighbourObject) return false; } + + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + if(neighbourObject == null) return false; + + bool isConnected = (neighbourObject.HasAdjacencyConnector); + + isConnected &= neighbourObject.GenericType == TileObjectGenericType.Wall || + neighbourObject.GenericType == TileObjectGenericType.Door; + + if (neighbourObject.GetComponent() != null) + { + isConnected &= IsConnectedToDoor(neighbourObject); + } + + return isConnected; + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 6b5c4435da..3576e32f46 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -103,13 +103,13 @@ public void DestroySelf() public void UpdateAdjacencies(PlacedTileObject[] neighbourObjects) { if (HasAdjacencyConnector) - _connector.UpdateAll(neighbourObjects); + _connector.UpdateAllConnections(neighbourObjects); } public void UpdateSingleAdjacency(PlacedTileObject neighbourObject, Direction dir) { if (HasAdjacencyConnector) - _connector.UpdateSingle(dir, neighbourObject, false); + _connector.UpdateSingleConnection(dir, neighbourObject, false); } public SavedPlacedTileObject Save() From 554990bd6b767bac96112970f54cbe04d7148a9d Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 7 Oct 2023 18:22:59 +0200 Subject: [PATCH 11/87] fixed advanced adjacency --- .../Connections/AdjacencyTypes/AdvancedAdjacency.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs index 62931299f8..731ed9c331 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs @@ -97,9 +97,9 @@ public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap) case AdjacencyShape.XSingle: mesh = xSingle; Direction connectingDiagonal = adjacencyMap.GetSingleConnection(false); - rotation = connectingDiagonal == Direction.SouthWest ? 0f : - connectingDiagonal == Direction.SouthWest ? 90f : - connectingDiagonal == Direction.SouthEast ? 180f : -90f; + rotation = connectingDiagonal == Direction.NorthEast ? 0f : + connectingDiagonal == Direction.SouthEast ? 90f : + connectingDiagonal == Direction.SouthWest ? 180f : -90f; break; case AdjacencyShape.XOpposite: mesh = xOpposite; @@ -112,9 +112,9 @@ public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap) case AdjacencyShape.XTriple: mesh = xTriple; Direction nonConnectingDiagonal = adjacencyMap.GetSingleNonConnection(false); - rotation = nonConnectingDiagonal == Direction.SouthWest ? -90f : - nonConnectingDiagonal == Direction.SouthWest ? 0f : - nonConnectingDiagonal == Direction.SouthEast ? 90f : 180f; + rotation = nonConnectingDiagonal == Direction.NorthEast ? 90f : + nonConnectingDiagonal == Direction.SouthEast ? 180f : + nonConnectingDiagonal == Direction.SouthWest ? -90f : 0f; break; case AdjacencyShape.XQuad: mesh = xQuad; From 7da9a5cd7d084f84a7a603910673e2c15eb1ba66 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sun, 8 Oct 2023 16:51:38 +0200 Subject: [PATCH 12/87] fix multiadjcon --- .../Tile/Connections/MultiAdjacencyConnector.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs index 41beaef1fb..ec62bafa42 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs @@ -1,4 +1,4 @@ -using FishNet.Object; +using FishNet.Object; using FishNet.Object.Synchronizing; using SS3D.Logging; using SS3D.Systems.Tile.Connections.AdjacencyTypes; @@ -72,8 +72,9 @@ private void Setup() } } - public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { + Setup(); bool isConnected = false; bool isUpdated = false; @@ -98,14 +99,14 @@ public bool UpdateSingle(Direction dir, PlacedTileObject neighbourObject, bool u return isUpdated; } - public void UpdateAll(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { Setup(); bool changed = false; for (int i = 0; i < neighbourObjects.Length; i++) { - changed |= UpdateSingle((Direction)i, neighbourObjects[i], true); + changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); } if (changed) @@ -154,5 +155,10 @@ private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) UpdateMeshAndDirection(); } } + + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + throw new System.NotImplementedException(); + } } } \ No newline at end of file From 386696e4a6e5639f4531e731a007c3eb72ebbb25 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sun, 8 Oct 2023 18:26:54 +0200 Subject: [PATCH 13/87] add abstract horizontal connector class --- .../Structures/Doors/CivillianAirlock.prefab | 34 +++- .../Floors/Tiles/Carpet/FancyCarpetRed.prefab | 10 +- .../AbstractHorizontalConnector.cs | 155 ++++++++++++++++++ .../AbstractHorizontalConnector.cs.meta | 11 ++ .../AdjacencyTypes/AdvancedAdjacency.cs | 2 +- .../AdjacencyTypes/OffsetAdjacency.cs | 2 +- .../AdjacencyTypes/SimpleAdjacency.cs | 2 +- .../Connections/AdvancedAdjacencyConnector.cs | 135 +-------------- .../Connections/DoorAdjacencyConnector.cs | 112 +++---------- .../Connections/IMeshAndDirectionResolver.cs | 11 ++ .../IMeshAndDirectionResolver.cs.meta | 11 ++ .../Connections/SimpleAdjacencyConnector.cs | 124 +------------- .../Connections/WallAdjacencyConnector.cs | 2 +- 13 files changed, 258 insertions(+), 353 deletions(-) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs.meta diff --git a/Assets/Content/WorldObjects/Structures/Doors/CivillianAirlock.prefab b/Assets/Content/WorldObjects/Structures/Doors/CivillianAirlock.prefab index fd4201db84..4ed4b4f845 100644 --- a/Assets/Content/WorldObjects/Structures/Doors/CivillianAirlock.prefab +++ b/Assets/Content/WorldObjects/Structures/Doors/CivillianAirlock.prefab @@ -273,6 +273,7 @@ GameObject: - component: {fileID: 2079395355536659087} - component: {fileID: 7942135432533076774} - component: {fileID: -6616120420594439688} + - component: {fileID: -4703641988129057345} m_Layer: 0 m_Name: CivillianAirlock m_TagString: Untagged @@ -311,19 +312,26 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: - {fileID: -6616120420594439688} + - {fileID: -4703641988129057345} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 66 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 7168612627150811407 - _sceneNetworkObjects: [] --- !u!114 &-6616120420594439688 MonoBehaviour: m_ObjectHideFlags: 0 @@ -345,6 +353,28 @@ MonoBehaviour: _interpolation: 2 _clientAuthoritative: 1 _sendToOwner: 0 +--- !u!114 &-4703641988129057345 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7133738675197207439} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d00d6a1b2cb9fb54fbefde21a9eb88a4, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 1 + _addedNetworkObject: {fileID: 7942135432533076774} + _networkObjectCache: {fileID: 7942135432533076774} + _genericType: 13 + _specificType: 3 + _syncedConnections: 0 + connector: + unique: {fileID: 0} + wallCapPrefab: {fileID: 3591147544166670882, guid: 9682b163cae64f74a93b6e84ce84ae5b, type: 3} + doorType: 0 --- !u!1001 &2157331936072973061 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab b/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab index 56a86f96c9..6a193a8085 100644 --- a/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab +++ b/Assets/Content/WorldObjects/Structures/Floors/Tiles/Carpet/FancyCarpetRed.prefab @@ -115,7 +115,7 @@ MonoBehaviour: k__BackingField: 0 k__BackingField: {fileID: 0} _networkBehaviours: - - {fileID: 0} + - {fileID: 3040907911380660968} k__BackingField: {fileID: 0} k__BackingField: [] SerializedTransformProperties: @@ -144,12 +144,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 0 _addedNetworkObject: {fileID: 6999522401175031449} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: 6999522401175031449} _genericType: 9 _specificType: 5 - _advancedAdjacency: + _syncedConnections: 0 + advancedAdjacency: o: {fileID: 6313828114514605112, guid: 672e6a3c2617a374084ca41ab0f3b39d, type: 3} u: {fileID: 1428770310312528737, guid: 672e6a3c2617a374084ca41ab0f3b39d, type: 3} i: {fileID: -1544124563803091405, guid: 672e6a3c2617a374084ca41ab0f3b39d, type: 3} @@ -167,4 +168,3 @@ MonoBehaviour: xQuad: {fileID: 9022132694264211953, guid: 672e6a3c2617a374084ca41ab0f3b39d, type: 3} viewObstacles: [] opaque: 0 - _syncedConnections: 0 diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs new file mode 100644 index 0000000000..ca03ae756c --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -0,0 +1,155 @@ +using FishNet.Object.Synchronizing; +using JetBrains.Annotations; +using SS3D.Core.Behaviours; +using SS3D.Logging; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Tile.Connections +{ + public abstract class AbstractHorizontalConnector : NetworkActor, IAdjacencyConnector + { + + /// + /// A type that specifies to which objects to connect to. + /// + [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] + [SerializeField] + protected TileObjectGenericType _genericType; + + /// + /// Specific ID to differentiate objects when the generic is the same. + /// + [Tooltip("Specific ID to differentiate objects when the generic is the same.")] + [SerializeField] + protected TileObjectSpecificType _specificType; + + protected abstract IMeshAndDirectionResolver AdjacencyResolver { get; } + + protected AdjacencyMap _adjacencyMap; + + protected MeshFilter _filter; + protected PlacedTileObject _placedObject; + + public PlacedTileObject PlacedObject => _placedObject; + + [SyncVar(OnChange = nameof(SyncAdjacencies))] + private byte _syncedConnections; + + private bool _initialized; + + public override void OnStartClient() + { + base.OnStartClient(); + Setup(); + } + + private void Setup() + { + if (!_initialized) + { + _adjacencyMap = new AdjacencyMap(); + _filter = GetComponent(); + + _placedObject = GetComponent(); + if (_placedObject == null) + { + _genericType = TileObjectGenericType.None; + _specificType = TileObjectSpecificType.None; + } + else + { + _genericType = _placedObject.GenericType; + _specificType = _placedObject.SpecificType; + } + _initialized = true; + } + } + + public abstract bool IsConnected(Direction dir, PlacedTileObject neighbourObject); + + public virtual void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + { + Setup(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); + } + + if (changed) + { + UpdateMeshAndDirection(); + } + } + + public virtual bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + { + Setup(); + + bool isConnected = IsConnected(dir, neighbourObject); + + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + + bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + + if (isUpdated) + { + _syncedConnections = _adjacencyMap.SerializeToByte(); + UpdateMeshAndDirection(); + } + + return isUpdated; + } + + private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) + { + if (!asServer) + { + Setup(); + + _adjacencyMap.DeserializeFromByte(newValue); + UpdateMeshAndDirection(); + } + } + + + protected void UpdateMeshAndDirection() + { + // Some connectors might not have to update mesh or direction at all. + if (AdjacencyResolver == null) return; + + MeshDirectionInfo info = new(); + info = AdjacencyResolver.GetMeshAndDirection(_adjacencyMap); + + if (_filter == null) + { + Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + } + + _filter.mesh = info.Mesh; + + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); + + transform.localRotation = localRotation; + } + + /// + /// Sets a given direction blocked. This means that it will no longer be allowed to connect on that direction. + /// + /// + /// + public void SetBlockedDirection(Direction dir, bool value) + { + _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); + UpdateMeshAndDirection(); + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs.meta new file mode 100644 index 0000000000..81ce7eb850 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c00cf67fec139940a34518bf88d6691 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs index 731ed9c331..89cbef84be 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs @@ -7,7 +7,7 @@ namespace SS3D.Systems.Tile.Connections.AdjacencyTypes /// Adjacency type used for objects that do require complex connections. /// [Serializable] - public struct AdvancedConnector + public struct AdvancedConnector : IMeshAndDirectionResolver { [Tooltip("A mesh where no edges are connected")] public Mesh o; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs index f833b63c23..ed43ce6edf 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs @@ -7,7 +7,7 @@ namespace SS3D.Systems.Tile.Connections.AdjacencyTypes /// Adjacency type used for objects that are not centred on a tile. Examples that use this are pipes (not the middle layer) /// [Serializable] - public struct OffsetConnector + public struct OffsetConnector : IMeshAndDirectionResolver { public enum OffsetOrientation { diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs index d6e1a459c2..1273974f0a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs @@ -7,7 +7,7 @@ namespace SS3D.Systems.Tile.Connections.AdjacencyTypes /// Adjacency type used for objects that do not require complex connections. /// [Serializable] - public struct SimpleConnector + public struct SimpleConnector : IMeshAndDirectionResolver { [Tooltip("A mesh where no edges are connected")] public Mesh o; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs index 7af9443c62..a85c3fa33e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs @@ -9,82 +9,12 @@ namespace SS3D.Systems.Tile.Connections { - public class AdvancedAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector + public class AdvancedAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { - /// - /// A type that specifies to which objects to connect to. Must be set if cross connect is used. - /// - [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] - [SerializeField] - private TileObjectGenericType _genericType; + [SerializeField] private AdvancedConnector advancedAdjacency; + protected override IMeshAndDirectionResolver AdjacencyResolver => advancedAdjacency; - /// - /// Specific ID to differentiate objects when the generic is the same. - /// - [Tooltip("Specific ID to differentiate objects when the generic is the same.")] - [SerializeField] - private TileObjectSpecificType _specificType; - - [FormerlySerializedAs("advancedAdjacency")][SerializeField] private AdvancedConnector _advancedAdjacency; - - private AdjacencyMap _adjacencyMap; - - [SyncVar(OnChange = nameof(SyncAdjacencies))] - private byte _syncedConnections; - - private MeshFilter _filter; - private bool _initialized; - private PlacedTileObject _placedObject; - - public override void OnStartClient() - { - base.OnStartClient(); - Setup(); - } - - private void Setup() - { - if (!_initialized) - { - _adjacencyMap = new AdjacencyMap(); - _filter = GetComponent(); - - _placedObject = GetComponent(); - if (_placedObject == null) - { - _genericType = TileObjectGenericType.None; - _specificType = TileObjectSpecificType.None; - } - else - { - _genericType = _placedObject.GenericType; - _specificType = _placedObject.SpecificType; - } - _initialized = true; - } - } - - public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) - { - Setup(); - bool isConnected = IsConnected(dir, neighbourObject); - bool isUpdated; - - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); - - isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - if (isUpdated) - { - _syncedConnections = _adjacencyMap.SerializeToByte(); - UpdateMeshAndDirection(); - } - - return isUpdated; - } - - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) { bool isConnected = false; if (neighbourObject) @@ -95,62 +25,5 @@ public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) } return isConnected; } - - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) - { - Setup(); - - bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) - { - changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); - } - - if (changed) - { - UpdateMeshAndDirection(); - } - } - - private void UpdateMeshAndDirection() - { - MeshDirectionInfo info = new(); - info = _advancedAdjacency.GetMeshAndDirection(_adjacencyMap); - - if (_filter == null) - { - Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); - } - - _filter.mesh = info.Mesh; - - Quaternion localRotation = transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); - - transform.localRotation = localRotation; - } - - private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) - { - if (!asServer) - { - Setup(); - - _adjacencyMap.DeserializeFromByte(newValue); - UpdateMeshAndDirection(); - } - } - - /// - /// Sets a given direction blocked. This means that it will no longer be allowed to connect on that direction. - /// - /// - /// - public void SetBlockedDirection(Direction dir, bool value) - { - _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); - UpdateMeshAndDirection(); - } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index 540a0b2171..ff2a2b8efd 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -6,14 +6,18 @@ namespace SS3D.Systems.Tile.Connections { - public class DoorAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector + public class DoorAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { - public enum DoorType + private enum DoorType { Single, Double }; + public Direction DoorDirection => _placedObject.Direction; + + protected override IMeshAndDirectionResolver AdjacencyResolver => null; + /** Based on peculiarities of the model, the appropriate position of the wall cap */ private const float WALL_CAP_DISTANCE_FROM_CENTRE = 0f; @@ -24,84 +28,21 @@ public enum DoorType [SerializeField] private DoorType doorType; - private TileMap map; - public PlacedTileObject placedTileObject; - - private bool _initialized = false; - // WallCap gameobjects, North, East, South, West. Null if not present. private GameObject[] wallCaps = new GameObject[4]; - private AdjacencyMap adjacencyMap = new AdjacencyMap(); - - public override void OnStartClient() - { - base.OnStartClient(); - Setup(); - } - - private void Setup() - { - if (!_initialized) - { - adjacencyMap = new AdjacencyMap(); - placedTileObject = GetComponent(); - _initialized = true; - } - } - - public void CleanAdjacencies() + public override bool UpdateSingleConnection(Direction direction, PlacedTileObject placedObject, bool updateNeighbours) { - if (!map) - { - map = GetComponentInParent(); - } - - var neighbourObjects = map.GetNeighbourPlacedObjects(TileLayer.Turf, transform.position); - for (int i = 0; i < neighbourObjects.Length; i++) - { - neighbourObjects[i]?.UpdateSingleAdjacency(placedTileObject, - TileHelper.GetOpposite((Direction)i)); - } - } - - public bool UpdateSingleConnection(Direction direction, PlacedTileObject placedObject, bool updateNeighbours) - { - Setup(); - - bool isConnected = IsConnected(direction, placedObject); - bool update = adjacencyMap.SetConnection(direction, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - + bool update = base.UpdateSingleConnection(direction, placedObject, updateNeighbours); if (update) UpdateWallCaps(); - - return true; + return update; } - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + public override void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { - Setup(); - if (!map) - map = GetComponentInParent(); - - neighbourObjects = map.GetNeighbourPlacedObjects(TileLayer.Turf, transform.position); - PlacedTileObject currentObject = GetComponent(); - - bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) - { - bool updatedSingle = false; - updatedSingle = UpdateSingleConnection((Direction)i, neighbourObjects[i], true); - if (updatedSingle && neighbourObjects[i]) - neighbourObjects[i].UpdateSingleAdjacency(currentObject, TileHelper.GetOpposite((Direction)i)); - - changed |= updatedSingle; - } - - if (changed) - { - UpdateWallCaps(); - } + base.UpdateAllConnections(neighbourObjects); + UpdateWallCaps(); } private void CreateWallCaps(bool isPresent, Direction direction) @@ -125,27 +66,26 @@ private void UpdateWallCaps() if (wallCapPrefab == null) return; - Direction outFacing = TileHelper.GetNextDir(GetDoorDirection()); + Direction outFacing = TileHelper.GetNextDir(DoorDirection); - bool isPresent = adjacencyMap.HasConnection(outFacing); + bool isPresent = _adjacencyMap.HasConnection(outFacing); CreateWallCaps(isPresent, outFacing); - isPresent = adjacencyMap.HasConnection(TileHelper.GetOpposite(outFacing)); + isPresent = _adjacencyMap.HasConnection(TileHelper.GetOpposite(outFacing)); CreateWallCaps(isPresent, TileHelper.GetOpposite(outFacing)); } /** - * Spawns a wall cap facing a direction, with appropriate position & settings - * Direction from the centre of the door - */ + * Spawns a wall cap facing a direction, with appropriate position & settings + * Direction from the centre of the door + */ private GameObject SpawnWallCap(Direction direction) { var wallCap = Instantiate(wallCapPrefab, transform); - Direction doorDirection = GetDoorDirection(); - Direction cardinalDirectionInput = TileHelper.GetRelativeDirection(direction, doorDirection); + Direction cardinalDirectionInput = TileHelper.GetRelativeDirection(direction, DoorDirection); var cardinal = TileHelper.ToCardinalVector(cardinalDirectionInput); - float rotation = TileHelper.AngleBetween(direction, doorDirection); + float rotation = TileHelper.AngleBetween(direction, DoorDirection); wallCap.transform.localRotation = Quaternion.Euler(0, rotation, 0); @@ -154,17 +94,7 @@ private GameObject SpawnWallCap(Direction direction) return wallCap; } - private Direction GetDoorDirection() - { - if (placedTileObject == null) - { - placedTileObject = GetComponent(); - } - - return placedTileObject.Direction; - } - - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) { return (neighbourObject && neighbourObject.HasAdjacencyConnector && neighbourObject.GenericType == TileObjectGenericType.Wall); diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs new file mode 100644 index 0000000000..f3fada01cb --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs @@ -0,0 +1,11 @@ +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using SS3D.Systems.Tile.Connections; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; + +public interface IMeshAndDirectionResolver +{ + public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap); +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs.meta new file mode 100644 index 0000000000..6232bcceec --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 35605c4cd54efc2459983a7893c0c233 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs index 8e3fb31a6d..470aea8e0a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs @@ -13,128 +13,12 @@ namespace SS3D.Systems.Tile.Connections /// /// Good for stuff that connects on the same layer only, horizontally, of the same specific and generic type. /// - public class SimpleAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector + public class SimpleAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { - /// - /// A type that specifies to which objects to connect to. Must be set if cross connect is used. - /// - [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] - [SerializeField] - private TileObjectGenericType _genericType; + [SerializeField] private SimpleConnector simpleAdjacency; + protected override IMeshAndDirectionResolver AdjacencyResolver => simpleAdjacency; - /// - /// Specific ID to differentiate objects when the generic is the same. - /// - [Tooltip("Specific ID to differentiate objects when the generic is the same.")] - [SerializeField] - private TileObjectSpecificType _specificType; - - [SerializeField] private SimpleConnector _simpleAdjacency; - - [SyncVar(OnChange = nameof(SyncAdjacencies))] - private byte _syncedConnections; - - private AdjacencyMap _adjacencyMap; - private MeshFilter _filter; - private bool _initialized; - private PlacedTileObject _placedObject; - - public override void OnStartClient() - { - base.OnStartClient(); - Setup(); - } - - private void Setup() - { - if (!_initialized) - { - _adjacencyMap = new AdjacencyMap(); - _filter = GetComponent(); - - _placedObject = GetComponent(); - if (_placedObject == null) - { - _genericType = TileObjectGenericType.None; - _specificType = TileObjectSpecificType.None; - } - else - { - _genericType = _placedObject.GenericType; - _specificType = _placedObject.SpecificType; - } - _initialized = true; - } - } - - private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) - { - if (!asServer) - { - Setup(); - - _adjacencyMap.DeserializeFromByte(newValue); - UpdateMeshAndDirection(); - } - } - - public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) - { - Setup(); - - bool isConnected = IsConnected(dir, neighbourObject); - - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); - - bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - - if (isUpdated) - { - _syncedConnections = _adjacencyMap.SerializeToByte(); - UpdateMeshAndDirection(); - } - - return isUpdated; - } - - private void UpdateMeshAndDirection() - { - MeshDirectionInfo info = new(); - info = _simpleAdjacency.GetMeshAndDirection(_adjacencyMap); - - if (_filter == null) - { - Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); - } - - _filter.mesh = info.Mesh; - - Quaternion localRotation = transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); - - transform.localRotation = localRotation; - } - - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) - { - Setup(); - - bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) - { - changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); - } - - if (changed) - { - UpdateMeshAndDirection(); - } - } - - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) { bool isConnected = false; if (neighbourObject != null) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs index 2801732ee1..790416df1f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs @@ -158,7 +158,7 @@ public void SetBlockedDirection(Direction dir, bool value) private bool IsConnectedToDoor(PlacedTileObject neighbourObject) { var doorConnector = neighbourObject.GetComponent(); - var door = doorConnector.placedTileObject; + var door = doorConnector.PlacedObject; if (door != null) { if (_placedObject.IsOnLeft(door) || _placedObject.IsOnRight(door)) From b7868886760fe3d59fb8e676832e918d2364cb29 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sun, 8 Oct 2023 19:43:46 +0200 Subject: [PATCH 14/87] fix airlock generic type --- .../TileMap/Resources/Structures/Doors/AirlockCivilian.asset | 2 +- .../TileMap/Resources/Structures/Doors/AirlockSecurity.asset | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockCivilian.asset b/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockCivilian.asset index cf4077ab61..e0ecc44f70 100644 --- a/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockCivilian.asset +++ b/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockCivilian.asset @@ -16,7 +16,7 @@ MonoBehaviour: prefab: {fileID: 7133738675197207439, guid: 84a5596b28f449e49bb34741abf89d30, type: 3} icon: {fileID: 0} layer: 1 - genericType: 3 + genericType: 13 specificType: 0 width: 1 height: 1 diff --git a/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockSecurity.asset b/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockSecurity.asset index d62f88f72a..d22fa049ef 100644 --- a/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockSecurity.asset +++ b/Assets/Content/Data/TileMap/Resources/Structures/Doors/AirlockSecurity.asset @@ -16,7 +16,7 @@ MonoBehaviour: prefab: {fileID: 7133738675197207439, guid: d25b39d1e2379b64cba47629530ada78, type: 3} icon: {fileID: 0} layer: 1 - genericType: 3 + genericType: 13 specificType: 0 width: 1 height: 1 From f9f2f888228cc0b2b91bf56088c201539f806498 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sun, 8 Oct 2023 22:11:09 +0200 Subject: [PATCH 15/87] trying to fix edge case for wall connector --- .../Connections/WallAdjacencyConnector.cs | 177 ++++-------------- 1 file changed, 40 insertions(+), 137 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs index 790416df1f..f7bfee79b7 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs @@ -1,6 +1,7 @@ using DG.Tweening; using FishNet.Object; using FishNet.Object.Synchronizing; +using SS3D.Core; using SS3D.Logging; using SS3D.Systems.Tile.Connections; using SS3D.Systems.Tile.Connections.AdjacencyTypes; @@ -10,165 +11,51 @@ namespace SS3D.Systems.Tile.Connections { - public class WallAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector + public class WallAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { - /// - /// A type that specifies to which objects to connect to. Must be set if cross connect is used. - /// - [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] - [SerializeField] - private TileObjectGenericType _genericType; - - /// - /// Specific ID to differentiate objects when the generic is the same. - /// - [Tooltip("Specific ID to differentiate objects when the generic is the same.")] - [SerializeField] - private TileObjectSpecificType _specificType; [SerializeField] private AdvancedConnector _advancedAdjacency; - private AdjacencyMap _adjacencyMap; - - [SyncVar(OnChange = nameof(SyncAdjacencies))] - private byte _syncedConnections; - - private MeshFilter _filter; - private bool _initialized; - private PlacedTileObject _placedObject; + protected override IMeshAndDirectionResolver AdjacencyResolver => _advancedAdjacency; - public override void OnStartClient() - { - base.OnStartClient(); - Setup(); - } - - private void Setup() + private bool IsConnectedToDoor(PlacedTileObject neighbourObject) { - if (!_initialized) + var doorConnector = neighbourObject.GetComponent(); + var door = doorConnector.PlacedObject; + if (door != null) { - _adjacencyMap = new AdjacencyMap(); - _filter = GetComponent(); - - _placedObject = GetComponent(); - if (_placedObject == null) - { - _genericType = TileObjectGenericType.None; - _specificType = TileObjectSpecificType.None; - } - else + if (_placedObject.IsOnLeft(door) || _placedObject.IsOnRight(door)) { - _genericType = _placedObject.GenericType; - _specificType = _placedObject.SpecificType; + return true; } - _initialized = true; + } + return false; } - public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + private bool TryGetOnLeftOrRightDoor(out PlacedTileObject door) { - Setup(); - bool isConnected = IsConnected(dir, neighbourObject); - bool isUpdated = false; + var tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + var neighbours = map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); - if (neighbourObject != null) + foreach( var neighbour in neighbours ) { - isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + var doorConnector = neighbour?.GetComponent(); + if (doorConnector == null) continue; - isConnected &= neighbourObject.GenericType == TileObjectGenericType.Wall || - neighbourObject.GenericType == TileObjectGenericType.Door; - - if (neighbourObject.GetComponent() != null) + if (_placedObject.IsOnLeft(neighbour) || _placedObject.IsOnRight(neighbour)) { - isConnected &= IsConnectedToDoor(neighbourObject); - } - - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); - } - - isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - if (isUpdated) - { - _syncedConnections = _adjacencyMap.SerializeToByte(); - UpdateMeshAndDirection(); - } - - return isUpdated; - } - - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) - { - Setup(); - - bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) - { - changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); - } - - if (changed) - { - UpdateMeshAndDirection(); - } - } - - private void UpdateMeshAndDirection() - { - MeshDirectionInfo info = new(); - info = _advancedAdjacency.GetMeshAndDirection(_adjacencyMap); - - if (_filter == null) - { - Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); - } - - _filter.mesh = info.Mesh; - - Quaternion localRotation = transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); - - transform.localRotation = localRotation; - } - - private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) - { - if (!asServer) - { - Setup(); - - _adjacencyMap.DeserializeFromByte(newValue); - UpdateMeshAndDirection(); - } - } - - /// - /// Sets a given direction blocked. This means that it will no longer be allowed to connect on that direction. - /// - /// - /// - public void SetBlockedDirection(Direction dir, bool value) - { - _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); - UpdateMeshAndDirection(); - } - - private bool IsConnectedToDoor(PlacedTileObject neighbourObject) - { - var doorConnector = neighbourObject.GetComponent(); - var door = doorConnector.PlacedObject; - if (door != null) - { - if (_placedObject.IsOnLeft(door) || _placedObject.IsOnRight(door)) + door = neighbour; return true; + } + } - + door = null; return false; } - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) { if(neighbourObject == null) return false; @@ -182,6 +69,22 @@ public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) isConnected &= IsConnectedToDoor(neighbourObject); } + var tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + + // Needed for a weird edge case when you put walls all around a door. Will avoid connecting + // to a wall in front or behind the door, if this wall is itself connected to door. + // This is to avoid the wall considering there's 3 connections, because if it does, it takes + // a L2 shape which allow to see through the wall. + + if(TryGetOnLeftOrRightDoor(out PlacedTileObject door) && neighbourObject.GetComponent() != null) + { + if (neighbourObject.IsInFront(door) || neighbourObject.IsBehind(door)) + { + isConnected &= false; + } + } + return isConnected; } } From f8256d61a658aa0b5ed7877429d6a6edde2e5947 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 9 Oct 2023 00:32:39 +0200 Subject: [PATCH 16/87] fix edge case wall, fix advancedAdjacency --- .../AdjacencyTypes/AdvancedAdjacency.cs | 6 +++--- .../Tile/PlacedObjects/PlacedTileObject.cs | 21 +++++++++++++++---- Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs | 2 +- .../SS3D/Systems/Tile/TileConstants.cs | 11 ++++++++++ .../SS3D/Systems/Tile/TileConstants.cs.meta | 11 ++++++++++ Assets/Scripts/SS3D/Utils/MathUtility.cs | 14 +++++++++++++ Assets/Scripts/SS3D/Utils/MathUtility.cs.meta | 11 ++++++++++ 7 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs.meta create mode 100644 Assets/Scripts/SS3D/Utils/MathUtility.cs create mode 100644 Assets/Scripts/SS3D/Utils/MathUtility.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs index 89cbef84be..8ccdee58b7 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/AdvancedAdjacency.cs @@ -97,9 +97,9 @@ public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap) case AdjacencyShape.XSingle: mesh = xSingle; Direction connectingDiagonal = adjacencyMap.GetSingleConnection(false); - rotation = connectingDiagonal == Direction.NorthEast ? 0f : - connectingDiagonal == Direction.SouthEast ? 90f : - connectingDiagonal == Direction.SouthWest ? 180f : -90f; + rotation = connectingDiagonal == Direction.NorthEast ? 180f : + connectingDiagonal == Direction.SouthEast ? 270f : + connectingDiagonal == Direction.SouthWest ? 0f : 90f; break; case AdjacencyShape.XOpposite: mesh = xOpposite; diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 3576e32f46..aab39d1eb6 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -7,6 +7,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using math = SS3D.Utils.MathUtility; namespace SS3D.Systems.Tile { @@ -127,7 +128,10 @@ public SavedPlacedTileObject Save() /// public bool IsInFront(PlacedTileObject other) { - if(Origin == other.Origin + TileHelper.CoordinateDifferenceInFrontFacingDirection(other.Direction)) + Vector2Int diff = TileHelper.CoordinateDifferenceInFrontFacingDirection(other.Direction); + Vector2Int OtherMoved = new Vector2Int(math.mod(other.Origin.x + diff.x, TileConstants.ChunkSize), + math.mod(other.Origin.y + diff.y, TileConstants.ChunkSize)); + if (Origin == OtherMoved) return true; return false; @@ -138,7 +142,10 @@ public bool IsInFront(PlacedTileObject other) /// public bool IsBehind(PlacedTileObject other) { - if (Origin == other.Origin - TileHelper.CoordinateDifferenceInFrontFacingDirection(other.Direction)) + Vector2Int diff = TileHelper.CoordinateDifferenceInFrontFacingDirection(other.Direction); + Vector2Int OtherMoved = new Vector2Int(math.mod(other.Origin.x - diff.x, TileConstants.ChunkSize), + math.mod(other.Origin.y - diff.y, TileConstants.ChunkSize)); + if (Origin == OtherMoved) return true; return false; @@ -150,7 +157,10 @@ public bool IsBehind(PlacedTileObject other) public bool IsOnRight(PlacedTileObject other) { Direction dirOnRight = TileHelper.GetNextCardinalDir(other.Direction); - if (Origin == other.Origin + TileHelper.CoordinateDifferenceInFrontFacingDirection(dirOnRight)) + Vector2Int diff = TileHelper.CoordinateDifferenceInFrontFacingDirection(dirOnRight); + Vector2Int OtherMoved = new Vector2Int(math.mod(other.Origin.x + diff.x, TileConstants.ChunkSize), + math.mod(other.Origin.y + diff.y, TileConstants.ChunkSize)); + if (Origin == OtherMoved) return true; return false; @@ -162,7 +172,10 @@ public bool IsOnRight(PlacedTileObject other) public bool IsOnLeft(PlacedTileObject other) { Direction dirOnLeft = TileHelper.GetNextCardinalDir(other.Direction); - if (Origin == other.Origin - TileHelper.CoordinateDifferenceInFrontFacingDirection(dirOnLeft)) + Vector2Int diff = TileHelper.CoordinateDifferenceInFrontFacingDirection(dirOnLeft); + Vector2Int OtherMoved = new Vector2Int(math.mod(other.Origin.x - diff.x, TileConstants.ChunkSize), + math.mod(other.Origin.y - diff.y, TileConstants.ChunkSize)); + if (Origin == OtherMoved) return true; return false; diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs b/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs index 58bd4222c1..ee8a70fc35 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs @@ -17,7 +17,7 @@ public class TileChunk: NetworkBehaviour /// /// Number of TileObjects that should go in a chunk. 16 x 16 /// - public const int ChunkSize = 16; + public const int ChunkSize = TileConstants.ChunkSize; /// /// Grid for grouping TileObjects per layer. Can be used for walking through objects on the same layer fast. diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs b/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs new file mode 100644 index 0000000000..e104c8053f --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs @@ -0,0 +1,11 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Tile +{ + public static class TileConstants + { + public const int ChunkSize = 16; + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs.meta new file mode 100644 index 0000000000..eb2a00a2c6 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 99e1bf6c48bedee44bcba95eff20a9f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Utils/MathUtility.cs b/Assets/Scripts/SS3D/Utils/MathUtility.cs new file mode 100644 index 0000000000..b94222ae9b --- /dev/null +++ b/Assets/Scripts/SS3D/Utils/MathUtility.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Utils +{ + public static class MathUtility + { + public static int mod(int x, int m) + { + return (x % m + m) % m; + } + } +} diff --git a/Assets/Scripts/SS3D/Utils/MathUtility.cs.meta b/Assets/Scripts/SS3D/Utils/MathUtility.cs.meta new file mode 100644 index 0000000000..048f63afe8 --- /dev/null +++ b/Assets/Scripts/SS3D/Utils/MathUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb04a492dbbe1234587b5fa00e5c5b19 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From d525f8b6e6821c49e2defa7072b1ab2c80297cac Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 9 Oct 2023 09:46:12 +0200 Subject: [PATCH 17/87] fix pipes --- .../Pipes/Atmospherics/AtmosPipesL1.prefab | 65 +++++++------------ .../Pipes/Atmospherics/AtmosPipesL2.prefab | 60 +++++------------ .../Pipes/Atmospherics/AtmosPipesL3.prefab | 65 +++++++------------ .../Pipes/Atmospherics/AtmosPipesL4.prefab | 60 +++++------------ .../Pipes/Disposals/DisposalPipes.prefab | 4 +- .../AdjacencyTypes/OffsetAdjacency.cs | 6 +- .../AdjacencyTypes/SimpleAdjacency.cs | 8 +-- .../Connections/PipeAdjacencyConnector.cs | 27 ++++++++ .../PipeAdjacencyConnector.cs.meta | 11 ++++ 9 files changed, 131 insertions(+), 175 deletions(-) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs.meta diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL1.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL1.prefab index f6ec3550e6..ff354f853b 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL1.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL1.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: -7727686409064562107} - component: {fileID: -1074477776341974781} - component: {fileID: -4998431523760016775} - - component: {fileID: -3045989321448604518} + - component: {fileID: 2229135679135330135} m_Layer: 0 m_Name: AtmosPipesL1 m_TagString: Untagged @@ -49,18 +49,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: [] + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: 2229135679135330135} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 80 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 8763632944401273062 - _sceneNetworkObjects: [] --- !u!33 &-1074477776341974781 MeshFilter: m_ObjectHideFlags: 0 @@ -111,7 +118,7 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &-3045989321448604518 +--- !u!114 &2229135679135330135 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -120,40 +127,17 @@ MonoBehaviour: m_GameObject: {fileID: 2802364579275783218} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: 5a20750f8caa0c74a90e8083cc1cfc63, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 0 _addedNetworkObject: {fileID: -7727686409064562107} - _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 2 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - lNone: {fileID: 0} - lSingle: {fileID: 0} - tNone: {fileID: 0} - tSingleRight: {fileID: 0} - tSingleLeft: {fileID: 0} - tDouble: {fileID: 0} - xNone: {fileID: 0} - xSingle: {fileID: 0} - xSide: {fileID: 0} - xOpposite: {fileID: 0} - xTriple: {fileID: 0} - xQuad: {fileID: 0} - viewObstacles: [] - opaque: 0 - _offsetAdjacency: - o: {fileID: -4913184590784469283, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + _networkObjectCache: {fileID: -7727686409064562107} + _genericType: 1 + _specificType: 0 + _syncedConnections: 0 + _connector: + o: {fileID: 6771834481066591091, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} uNorth: {fileID: -4913184590784469283, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} uSouth: {fileID: -8982356636661201101, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} i: {fileID: 6771834481066591091, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} @@ -161,9 +145,8 @@ MonoBehaviour: lNW: {fileID: 2974487339661499261, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} lSE: {fileID: -8284340391569421606, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} lSW: {fileID: -710663454644857736, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tNEW: {fileID: -1565585996255746122, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tNSW: {fileID: -4415080472327585715, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tNSE: {fileID: -8084914691331622005, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tSWE: {fileID: -7828955826838884863, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tNEW: {fileID: -4415080472327585715, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tNSW: {fileID: -8084914691331622005, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tNSE: {fileID: -7828955826838884863, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tSWE: {fileID: -1565585996255746122, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} x: {fileID: 5978052073093224489, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - _syncedConnections: 0 diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL2.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL2.prefab index f39e531cbc..2dc99469b5 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL2.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL2.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: -7727686409064562107} - component: {fileID: -1074477776341974781} - component: {fileID: -4998431523760016775} - - component: {fileID: 3499879903942155925} + - component: {fileID: -6517569341867807780} m_Layer: 0 m_Name: AtmosPipesL2 m_TagString: Untagged @@ -49,18 +49,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: [] + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: 0} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 38 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 4320652076112192416 - _sceneNetworkObjects: [] --- !u!33 &-1074477776341974781 MeshFilter: m_ObjectHideFlags: 0 @@ -111,7 +118,7 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &3499879903942155925 +--- !u!114 &-6517569341867807780 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -120,50 +127,19 @@ MonoBehaviour: m_GameObject: {fileID: 2802364579275783218} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: bc6615260753fbd48af09343d5d55332, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 255 _addedNetworkObject: {fileID: -7727686409064562107} _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 0 - _simpleAdjacency: - o: {fileID: 6806338772768397739, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + _genericType: 1 + _specificType: 0 + _syncedConnections: 0 + simpleAdjacency: + o: {fileID: 7036212505407254772, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} u: {fileID: 6806338772768397739, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} i: {fileID: 7036212505407254772, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} l: {fileID: -5256883499956230631, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} t: {fileID: 5050685859000262806, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} x: {fileID: -1235811834921956882, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - _advancedAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - lNone: {fileID: 0} - lSingle: {fileID: 0} - tNone: {fileID: 0} - tSingleRight: {fileID: 0} - tSingleLeft: {fileID: 0} - tDouble: {fileID: 0} - xNone: {fileID: 0} - xSingle: {fileID: 0} - xSide: {fileID: 0} - xOpposite: {fileID: 0} - xTriple: {fileID: 0} - xQuad: {fileID: 0} - viewObstacles: [] - opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL3.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL3.prefab index 54c44ee689..76016c487f 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL3.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL3.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: -7727686409064562107} - component: {fileID: -1074477776341974781} - component: {fileID: -4998431523760016775} - - component: {fileID: 7129601957079650942} + - component: {fileID: -4640464187372749131} m_Layer: 0 m_Name: AtmosPipesL3 m_TagString: Untagged @@ -49,18 +49,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: [] + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: -4640464187372749131} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 30 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 3164900015479896782 - _sceneNetworkObjects: [] --- !u!33 &-1074477776341974781 MeshFilter: m_ObjectHideFlags: 0 @@ -111,7 +118,7 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &7129601957079650942 +--- !u!114 &-4640464187372749131 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -120,40 +127,17 @@ MonoBehaviour: m_GameObject: {fileID: 2802364579275783218} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: 5a20750f8caa0c74a90e8083cc1cfc63, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 0 _addedNetworkObject: {fileID: -7727686409064562107} - _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 2 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - lNone: {fileID: 0} - lSingle: {fileID: 0} - tNone: {fileID: 0} - tSingleRight: {fileID: 0} - tSingleLeft: {fileID: 0} - tDouble: {fileID: 0} - xNone: {fileID: 0} - xSingle: {fileID: 0} - xSide: {fileID: 0} - xOpposite: {fileID: 0} - xTriple: {fileID: 0} - xQuad: {fileID: 0} - viewObstacles: [] - opaque: 0 - _offsetAdjacency: - o: {fileID: 3280808188743794696, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + _networkObjectCache: {fileID: -7727686409064562107} + _genericType: 0 + _specificType: 0 + _syncedConnections: 0 + _connector: + o: {fileID: -1444037753683383277, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} uNorth: {fileID: 3280808188743794696, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} uSouth: {fileID: -3806360359158251138, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} i: {fileID: -1444037753683383277, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} @@ -161,9 +145,8 @@ MonoBehaviour: lNW: {fileID: -7474402538799832598, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} lSE: {fileID: -5765311014171972663, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} lSW: {fileID: -2676322450833060381, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tNEW: {fileID: -599376364307708729, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tNSW: {fileID: -1086356526325406277, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tNSE: {fileID: -7630757551065068057, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - tSWE: {fileID: 35210991009650323, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tSWE: {fileID: -599376364307708729, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tNEW: {fileID: -1086356526325406277, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tNSW: {fileID: -7630757551065068057, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + tNSE: {fileID: 35210991009650323, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} x: {fileID: 8288866924156647885, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - _syncedConnections: 0 diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL4.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL4.prefab index bd40d773c5..180167eab8 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL4.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Atmospherics/AtmosPipesL4.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: -7727686409064562107} - component: {fileID: -1074477776341974781} - component: {fileID: -4998431523760016775} - - component: {fileID: 5864662064664276516} + - component: {fileID: 4607519100304452876} m_Layer: 0 m_Name: AtmosPipesL4 m_TagString: Untagged @@ -49,18 +49,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: [] + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: 0} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 4544942681371158276 - _sceneNetworkObjects: [] --- !u!33 &-1074477776341974781 MeshFilter: m_ObjectHideFlags: 0 @@ -111,7 +118,7 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &5864662064664276516 +--- !u!114 &4607519100304452876 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -120,50 +127,19 @@ MonoBehaviour: m_GameObject: {fileID: 2802364579275783218} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: bc6615260753fbd48af09343d5d55332, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 255 _addedNetworkObject: {fileID: -7727686409064562107} _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 0 - _simpleAdjacency: - o: {fileID: 6854876588585920493, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} + _genericType: 1 + _specificType: 0 + _syncedConnections: 0 + simpleAdjacency: + o: {fileID: 5763238997108834030, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} u: {fileID: 6854876588585920493, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} i: {fileID: 5763238997108834030, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} l: {fileID: 3234200807627564179, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} t: {fileID: 6267177117203792215, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} x: {fileID: -2318244788085852191, guid: 013a2e526b13e1849b628bdc478f9c03, type: 3} - _advancedAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - lNone: {fileID: 0} - lSingle: {fileID: 0} - tNone: {fileID: 0} - tSingleRight: {fileID: 0} - tSingleLeft: {fileID: 0} - tDouble: {fileID: 0} - xNone: {fileID: 0} - xSingle: {fileID: 0} - xSide: {fileID: 0} - xOpposite: {fileID: 0} - xTriple: {fileID: 0} - xQuad: {fileID: 0} - viewObstacles: [] - opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab index 0a8443be41..9cef843cae 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab @@ -135,11 +135,11 @@ MonoBehaviour: _networkObjectCache: {fileID: -7727686409064562107} _genericType: 1 _specificType: 0 - _simpleAdjacency: + _syncedConnections: 0 + simpleAdjacency: o: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} u: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} i: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} l: {fileID: -7002929985465626668, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} t: {fileID: 7767200051770316982, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} x: {fileID: -7993494061914831054, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} - _syncedConnections: 0 diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs index ed43ce6edf..fd8df908eb 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/OffsetAdjacency.cs @@ -42,14 +42,14 @@ public enum OffsetOrientation public Mesh lSE; [Tooltip("A mesh where the south & west edges are connected")] public Mesh lSW; + [Tooltip("A mesh where the South, west, & east edges are connected")] + public Mesh tSWE; [Tooltip("A mesh where the north, east, & west edges are connected")] public Mesh tNEW; [Tooltip("A mesh where the north, south, & west edges are connected")] public Mesh tNSW; [Tooltip("A mesh where the north, south, & east edges are connected")] public Mesh tNSE; - [Tooltip("A mesh where the South, west, & east edges are connected")] - public Mesh tSWE; [Tooltip("A mesh where all edges are connected")] public Mesh x; @@ -81,7 +81,7 @@ public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap) case AdjacencyShape.USouth: mesh = uSouth; _orientation = OffsetOrientation.USouth; - rotation = TileHelper.AngleBetween(Direction.South, adjacencyMap.GetSingleNonConnection()); + rotation = TileHelper.AngleBetween(Direction.South, adjacencyMap.GetSingleConnection()); break; case AdjacencyShape.I: mesh = i; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs index 1273974f0a..ab98abd2ff 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/SimpleAdjacency.cs @@ -36,19 +36,19 @@ public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap) break; case AdjacencyShape.U: mesh = u; - rotation = TileHelper.AngleBetween(Direction.South, adjacencyMap.GetSingleConnection()); + rotation = TileHelper.AngleBetween(Direction.North, adjacencyMap.GetSingleConnection()); break; case AdjacencyShape.I: mesh = i; - rotation = TileHelper.AngleBetween(Direction.South, adjacencyMap.HasConnection(Direction.South) ? Direction.South : Direction.West); + rotation = TileHelper.AngleBetween(Direction.North, adjacencyMap.HasConnection(Direction.South) ? Direction.South : Direction.West); break; case AdjacencyShape.L: mesh = l; - rotation = TileHelper.AngleBetween(Direction.SouthWest, adjacencyMap.GetDirectionBetweenTwoConnections()); + rotation = TileHelper.AngleBetween(Direction.NorthEast, adjacencyMap.GetDirectionBetweenTwoConnections()); break; case AdjacencyShape.T: mesh = t; - rotation = TileHelper.AngleBetween(Direction.South, adjacencyMap.GetSingleNonConnection()); + rotation = TileHelper.AngleBetween(Direction.North, adjacencyMap.GetSingleNonConnection()); break; case AdjacencyShape.X: mesh = x; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs new file mode 100644 index 0000000000..9e742f59dd --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs @@ -0,0 +1,27 @@ +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace SS3D.Systems.Tile.Connections +{ + public class PipeAdjacencyConnector : AbstractHorizontalConnector + { + [SerializeField] + private OffsetConnector _connector; + protected override IMeshAndDirectionResolver AdjacencyResolver => _connector; + + public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + bool isConnected = false; + if (neighbourObject != null) + { + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; + isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; + } + return isConnected; + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs.meta new file mode 100644 index 0000000000..1507fff956 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5a20750f8caa0c74a90e8083cc1cfc63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 6db61b240f6485e26baaf2e7ec134c675d42c3bb Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 9 Oct 2023 10:52:50 +0200 Subject: [PATCH 18/87] change pipe tile layers --- .../Pipes/Atmospherics/AtmosphericsPipesL1.asset | 4 ++-- .../Pipes/Atmospherics/AtmosphericsPipesL2.asset | 4 ++-- .../Pipes/Atmospherics/AtmosphericsPipesL3.asset | 4 ++-- .../Pipes/Atmospherics/AtmosphericsPipesL4.asset | 2 +- Assets/Scripts/SS3D/Systems/Tile/Enums/TileLayer.cs | 9 ++++++--- .../SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs | 7 +++++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL1.asset b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL1.asset index e3a37203ec..09e2a329d7 100644 --- a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL1.asset +++ b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL1.asset @@ -15,8 +15,8 @@ MonoBehaviour: nameString: pipe_atmos1 prefab: {fileID: 2802364579275783218, guid: de6f06ad18d50134295959f438ba9c5d, type: 3} icon: {fileID: 0} - layer: 4 - genericType: 0 + layer: 11 + genericType: 1 specificType: 0 width: 1 height: 1 diff --git a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL2.asset b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL2.asset index 9943832656..75925e4e26 100644 --- a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL2.asset +++ b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL2.asset @@ -15,8 +15,8 @@ MonoBehaviour: nameString: pipe_atmos2 prefab: {fileID: 2802364579275783218, guid: 251dc2a5fbda518429c8205c3b62165f, type: 3} icon: {fileID: 0} - layer: 4 - genericType: 0 + layer: 10 + genericType: 1 specificType: 0 width: 1 height: 1 diff --git a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL3.asset b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL3.asset index bf645d57bd..023a91a060 100644 --- a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL3.asset +++ b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL3.asset @@ -15,8 +15,8 @@ MonoBehaviour: nameString: pipe_atmos3 prefab: {fileID: 2802364579275783218, guid: adc07a7f0fee8304691f45a201509b13, type: 3} icon: {fileID: 0} - layer: 4 - genericType: 0 + layer: 12 + genericType: 1 specificType: 0 width: 1 height: 1 diff --git a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL4.asset b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL4.asset index 16fa40114a..1fac33e096 100644 --- a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL4.asset +++ b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Atmospherics/AtmosphericsPipesL4.asset @@ -16,7 +16,7 @@ MonoBehaviour: prefab: {fileID: 2802364579275783218, guid: 48efd00c91c310e4bb965d025c63b3ba, type: 3} icon: {fileID: 0} layer: 4 - genericType: 0 + genericType: 1 specificType: 0 width: 1 height: 1 diff --git a/Assets/Scripts/SS3D/Systems/Tile/Enums/TileLayer.cs b/Assets/Scripts/SS3D/Systems/Tile/Enums/TileLayer.cs index 4ad333909d..b29623d8b4 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Enums/TileLayer.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Enums/TileLayer.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -13,11 +13,14 @@ public enum TileLayer Turf, Wire, Disposal, - Pipes, + PipeSurface, WallMountHigh, WallMountLow, FurnitureBase, FurnitureTop, - Overlays + Overlays, + PipeMiddle, + PipeLeft, + PipeRight, } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs index 07601ef027..792a45c1b3 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs @@ -1,4 +1,4 @@ -using Coimbra; +using Coimbra; using FishNet.Connection; using FishNet.Object; using SS3D.Core; @@ -434,7 +434,10 @@ public void OnDropDownChange() { TileLayer.Wire, TileLayer.Disposal, - TileLayer.Pipes + TileLayer.PipeLeft, + TileLayer.PipeRight, + TileLayer.PipeSurface, + TileLayer.PipeMiddle }, false); break; From 9a3bf00003d9349f911eb004d576fe356ba664d1 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 9 Oct 2023 11:02:39 +0200 Subject: [PATCH 19/87] fix generic and specific type editablke in editor (should not) --- .../Generic/Surfaces/Tables/TablePoker.asset | 4 +- .../Generic/Surfaces/Tables/TableWood.asset | 4 +- .../Generic/Surfaces/Tables/TablePoker.prefab | 98 ++++++++--------- .../Generic/Surfaces/Tables/TableWood.prefab | 100 ++++++++---------- .../AbstractHorizontalConnector.cs | 13 +-- 5 files changed, 91 insertions(+), 128 deletions(-) diff --git a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TablePoker.asset b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TablePoker.asset index 56f672ec91..ad50653bbf 100644 --- a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TablePoker.asset +++ b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TablePoker.asset @@ -16,7 +16,7 @@ MonoBehaviour: prefab: {fileID: 3879826479501069436, guid: ebddb1721dcbe36499e4d093e5a7ff09, type: 3} icon: {fileID: 0} layer: 7 - genericType: 0 - specificType: 0 + genericType: 7 + specificType: 2 width: 1 height: 1 diff --git a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TableWood.asset b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TableWood.asset index b8cb704bf0..c8aa45c947 100644 --- a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TableWood.asset +++ b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Surfaces/Tables/TableWood.asset @@ -16,7 +16,7 @@ MonoBehaviour: prefab: {fileID: 3879826479501069436, guid: 5e8a02c5ce0073644ac01bdb55d72a70, type: 3} icon: {fileID: 0} layer: 7 - genericType: 0 - specificType: 0 + genericType: 7 + specificType: 4 width: 1 height: 1 diff --git a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TablePoker.prefab b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TablePoker.prefab index 6a3f885b7a..4157880e4d 100644 --- a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TablePoker.prefab +++ b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TablePoker.prefab @@ -12,8 +12,8 @@ GameObject: - component: {fileID: 72636884723696477} - component: {fileID: 4229887190052127918} - component: {fileID: 7514870336629038223} - - component: {fileID: 2413604077021371004} - component: {fileID: 5716146803221059512} + - component: {fileID: 5329512703703213614} m_Layer: 0 m_Name: TablePoker m_TagString: Untagged @@ -99,7 +99,7 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1, y: 0.75, z: 1} m_Center: {x: 0, y: 0.375, z: 0} ---- !u!114 &2413604077021371004 +--- !u!114 &5716146803221059512 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -108,21 +108,49 @@ MonoBehaviour: m_GameObject: {fileID: 3879826479501069436} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + k__BackingField: 0 + k__BackingField: 0 + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: 0} + k__BackingField: {fileID: 0} + k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} + _isNetworked: 1 + _isGlobal: 0 + _initializeOrder: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: 65535 + k__BackingField: 0 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 1168477607207407788 +--- !u!114 &5329512703703213614 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3879826479501069436} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 _addedNetworkObject: {fileID: 5716146803221059512} - _networkObjectCache: {fileID: 5716146803221059512} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: + _networkObjectCache: {fileID: 0} + _genericType: 7 + _specificType: 2 + _syncedConnections: 0 + advancedAdjacency: o: {fileID: 24074734363293705, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} u: {fileID: -9005001895540637488, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} i: {fileID: 4166674255622024098, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} @@ -140,45 +168,3 @@ MonoBehaviour: xQuad: {fileID: -3265789347127315492, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 ---- !u!114 &5716146803221059512 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3879826479501069436} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} - m_Name: - m_EditorClassIdentifier: - k__BackingField: 0 - k__BackingField: 0 - _networkBehaviours: - - {fileID: 2413604077021371004} - k__BackingField: {fileID: 0} - k__BackingField: [] - _isNetworked: 1 - _isGlobal: 0 - _defaultDespawnType: 0 - NetworkObserver: {fileID: 0} - k__BackingField: -1 - _scenePathHash: 0 - k__BackingField: 0 - k__BackingField: 1168477607207407788 - _sceneNetworkObjects: [] diff --git a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableWood.prefab b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableWood.prefab index 22cab135d7..7a5d3233e6 100644 --- a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableWood.prefab +++ b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableWood.prefab @@ -12,8 +12,8 @@ GameObject: - component: {fileID: 72636884723696477} - component: {fileID: 4229887190052127918} - component: {fileID: 7514870336629038223} - - component: {fileID: 5450892481641768436} - component: {fileID: 9015187684533357890} + - component: {fileID: 617431495096137990} m_Layer: 0 m_Name: TableWood m_TagString: Untagged @@ -99,7 +99,7 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1, y: 0.75, z: 1} m_Center: {x: 0, y: 0.375, z: 0} ---- !u!114 &5450892481641768436 +--- !u!114 &9015187684533357890 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -108,21 +108,49 @@ MonoBehaviour: m_GameObject: {fileID: 3879826479501069436} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + k__BackingField: 0 + k__BackingField: 0 + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: 0} + k__BackingField: {fileID: 0} + k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} + _isNetworked: 1 + _isGlobal: 0 + _initializeOrder: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: 86 + k__BackingField: 0 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 9226908801999324862 +--- !u!114 &617431495096137990 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3879826479501069436} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 _addedNetworkObject: {fileID: 9015187684533357890} - _networkObjectCache: {fileID: 9015187684533357890} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: + _networkObjectCache: {fileID: 0} + _genericType: 7 + _specificType: 4 + _syncedConnections: 0 + advancedAdjacency: o: {fileID: 3156538240660671990, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} u: {fileID: -3792656056309247605, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} i: {fileID: -1245183064925702563, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} @@ -135,50 +163,8 @@ MonoBehaviour: xNone: {fileID: -5187669296468267644, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} xSingle: {fileID: 5987645822847975186, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} xSide: {fileID: 5221760642665961722, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} - xOpposite: {fileID: 9165119008743474613, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} + xOpposite: {fileID: -3100042264156035534, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} xTriple: {fileID: -3100042264156035534, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} xQuad: {fileID: -6010099680322335773, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 ---- !u!114 &9015187684533357890 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3879826479501069436} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} - m_Name: - m_EditorClassIdentifier: - k__BackingField: 0 - k__BackingField: 0 - _networkBehaviours: - - {fileID: 5450892481641768436} - k__BackingField: {fileID: 0} - k__BackingField: [] - _isNetworked: 1 - _isGlobal: 0 - _defaultDespawnType: 0 - NetworkObserver: {fileID: 0} - k__BackingField: -1 - _scenePathHash: 0 - k__BackingField: 0 - k__BackingField: 9226908801999324862 - _sceneNetworkObjects: [] diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index ca03ae756c..7710bc2686 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -1,5 +1,6 @@ using FishNet.Object.Synchronizing; using JetBrains.Annotations; +using SS3D.Attributes; using SS3D.Core.Behaviours; using SS3D.Logging; using SS3D.Systems.Tile.Connections.AdjacencyTypes; @@ -11,19 +12,9 @@ namespace SS3D.Systems.Tile.Connections { public abstract class AbstractHorizontalConnector : NetworkActor, IAdjacencyConnector { - - /// - /// A type that specifies to which objects to connect to. - /// - [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] - [SerializeField] protected TileObjectGenericType _genericType; - /// - /// Specific ID to differentiate objects when the generic is the same. - /// - [Tooltip("Specific ID to differentiate objects when the generic is the same.")] - [SerializeField] + protected TileObjectSpecificType _specificType; protected abstract IMeshAndDirectionResolver AdjacencyResolver { get; } From f0c7b555aff4fc0db14d093b61bbc4cebcc6b3ac Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 9 Oct 2023 12:05:55 +0200 Subject: [PATCH 20/87] some doc and some cleanup --- .../AbstractHorizontalConnector.cs | 37 ++++++++++-- .../Connections/AdvancedAdjacencyConnector.cs | 3 + .../Connections/DoorAdjacencyConnector.cs | 26 ++++++-- .../Connections/IMeshAndDirectionResolver.cs | 4 ++ .../Connections/SimpleAdjacencyConnector.cs | 2 +- .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 60 +++++++++++++------ .../Tile/TileMapCreator/GhostManager.cs | 4 +- 7 files changed, 105 insertions(+), 31 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index 7710bc2686..f83765f91d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -10,6 +10,15 @@ namespace SS3D.Systems.Tile.Connections { + /// + /// Abstract class implementing the IAdjacencyConnector interface. + /// Idea of this class is to provide a basic implementation for all adjacency connector working mostly + /// on the same layer. This is because it uses the adjacencyMap, which consider only 8 possible connections. + /// It should be generic enough to work as a base class for most IAdjacencyConnector working with same + /// layer connections (so almost all of them). + /// It leaves to child classes to implement isConnected method, as this may vary greatly from one connector + /// to another. + /// public abstract class AbstractHorizontalConnector : NetworkActor, IAdjacencyConnector { protected TileObjectGenericType _genericType; @@ -22,6 +31,7 @@ public abstract class AbstractHorizontalConnector : NetworkActor, IAdjacencyConn protected AdjacencyMap _adjacencyMap; protected MeshFilter _filter; + protected PlacedTileObject _placedObject; public PlacedTileObject PlacedObject => _placedObject; @@ -31,12 +41,22 @@ public abstract class AbstractHorizontalConnector : NetworkActor, IAdjacencyConn private bool _initialized; + /// + /// Abstract method, as from one connector to another, the code to check for connection greatly changes. + /// + public abstract bool IsConnected(Direction dir, PlacedTileObject neighbourObject); + + public override void OnStartClient() { base.OnStartClient(); Setup(); } + /// + /// Simply set things up, including creating new references, and fetching generic and specific type + /// from the associated scriptable object. + /// private void Setup() { if (!_initialized) @@ -59,8 +79,9 @@ private void Setup() } } - public abstract bool IsConnected(Direction dir, PlacedTileObject neighbourObject); - + /// + /// Update all connections around this connector, updating mesh and directions eventually. + /// public virtual void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { Setup(); @@ -77,6 +98,9 @@ public virtual void UpdateAllConnections(PlacedTileObject[] neighbourObjects) } } + /// + /// Update a single connection, in a specific direction. Eventually also update the neighbour connection. + /// public virtual bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { Setup(); @@ -98,6 +122,9 @@ public virtual bool UpdateSingleConnection(Direction dir, PlacedTileObject neigh return isUpdated; } + /// + /// Sync adjacency map on client, and update mesh and direction using this new map. + /// private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) { if (!asServer) @@ -113,6 +140,7 @@ private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) protected void UpdateMeshAndDirection() { // Some connectors might not have to update mesh or direction at all. + // E.g : door connectors. if (AdjacencyResolver == null) return; MeshDirectionInfo info = new(); @@ -133,10 +161,9 @@ protected void UpdateMeshAndDirection() } /// - /// Sets a given direction blocked. This means that it will no longer be allowed to connect on that direction. + /// Sets a given direction blocked or unblocked. + /// If blocked, this means that it will no longer be allowed to connect on that direction (until further update). /// - /// - /// public void SetBlockedDirection(Direction dir, bool value) { _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs index a85c3fa33e..ef460bf7b5 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs @@ -9,6 +9,9 @@ namespace SS3D.Systems.Tile.Connections { + /// + /// Basic connector using the Advanced connector struct for resolving shape and direction. + /// public class AdvancedAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { [SerializeField] private AdvancedConnector advancedAdjacency; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index ff2a2b8efd..6fcb700b03 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -6,6 +6,10 @@ namespace SS3D.Systems.Tile.Connections { + /// + /// Connector for doors, handling adding wall caps, creating custom floor tile under the door. + /// TODO : add the custom floor. + /// public class DoorAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { private enum DoorType @@ -45,9 +49,12 @@ public override void UpdateAllConnections(PlacedTileObject[] neighbourObjects) UpdateWallCaps(); } + /// + /// Destroy or add a wall cap. + /// private void CreateWallCaps(bool isPresent, Direction direction) { - int capIndex = TileHelper.GetDirectionIndex(direction); + int capIndex = GetWallCapIndex(direction); if (isPresent && wallCaps[capIndex] == null) { @@ -66,7 +73,7 @@ private void UpdateWallCaps() if (wallCapPrefab == null) return; - Direction outFacing = TileHelper.GetNextDir(DoorDirection); + Direction outFacing = TileHelper.GetNextCardinalDir(DoorDirection); bool isPresent = _adjacencyMap.HasConnection(outFacing); CreateWallCaps(isPresent, outFacing); @@ -75,10 +82,9 @@ private void UpdateWallCaps() CreateWallCaps(isPresent, TileHelper.GetOpposite(outFacing)); } - /** - * Spawns a wall cap facing a direction, with appropriate position & settings - * Direction from the centre of the door - */ + + /// Spawns a wall cap facing a direction, with appropriate position & settings + ///Direction from the centre of the door private GameObject SpawnWallCap(Direction direction) { var wallCap = Instantiate(wallCapPrefab, transform); @@ -99,6 +105,14 @@ public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject return (neighbourObject && neighbourObject.HasAdjacencyConnector && neighbourObject.GenericType == TileObjectGenericType.Wall); } + + /// + /// Get the index of a wallcap in the wallcap Array. + /// + private int GetWallCapIndex(Direction dir) + { + return (int)dir / 2; + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs index f3fada01cb..9e4b03158c 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IMeshAndDirectionResolver.cs @@ -5,6 +5,10 @@ using UnityEngine; using System; +/// +/// Interface for classes that help adjacency connectors to determine a given shape and direction for the mesh, +/// given an adjacency map representing connections. +/// public interface IMeshAndDirectionResolver { public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap); diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs index 470aea8e0a..f9a79d8548 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs @@ -11,7 +11,7 @@ namespace SS3D.Systems.Tile.Connections { /// - /// Good for stuff that connects on the same layer only, horizontally, of the same specific and generic type. + /// Basic connector using the simple connector struct for resolving shape and direction. /// public class SimpleAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index 1cca7c76dc..0be84c9200 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -14,18 +14,12 @@ public static class TileHelper { private static TileLayer[] TileLayers; - public static Direction GetNextDir(Direction dir) - { - switch (dir) - { - default: - case Direction.South: return Direction.West; - case Direction.West: return Direction.North; - case Direction.North: return Direction.East; - case Direction.East: return Direction.South; - } - } + /// + /// Get a direction 90 degree clockwise from the one passed in parameter. + /// + /// + /// public static Direction GetNextCardinalDir(Direction dir) { switch (dir) @@ -42,11 +36,18 @@ public static Direction GetNextCardinalDir(Direction dir) } } + /// + /// Get the rotation angle of a particular dir. + /// E.g. assuming north is the initial position (should be), north return 0, north-east 45 ... + /// public static int GetRotationAngle(Direction dir) { return (int)dir * 45; } + /// + /// Get all different kind of tile layers. + /// public static TileLayer[] GetTileLayers() { if (TileLayers == null) @@ -56,6 +57,9 @@ public static TileLayer[] GetTileLayers() return TileLayers; } + /// + /// Get the offset in coordinates in a given direction. + /// public static Tuple ToCardinalVector(Direction direction) { return new Tuple( @@ -64,32 +68,43 @@ public static Tuple ToCardinalVector(Direction direction) ); } + /// + /// Get the closest round number world position on the plane where y = 0. + /// public static Vector3 GetClosestPosition(Vector3 worldPosition) { return new Vector3(Mathf.Round(worldPosition.x), 0, Mathf.Round(worldPosition.z)); } + /// + /// Get the relative direction between two direction. + /// E.g : to = North-East, from = South-West, return South. + /// TODO : maybe swith name of to and from, currently it feels it's the inverse way around. + /// public static Direction GetRelativeDirection(Direction to, Direction from) { return (Direction)((((int)to - (int)from) + 8) % 8); } - public static int GetDirectionIndex(Direction dir) - { - return (int)dir / 2; - } - - + /// + /// Return a list of the cardinal directions. + /// public static List CardinalDirections() { return new List { Direction.North, Direction.East, Direction.South, Direction.West }; } + /// + /// Return a list of the diagonal directions. + /// public static List DiagonalDirections() { return new List { Direction.NorthEast, Direction.SouthEast, Direction.SouthWest, Direction.NorthWest }; } + /// + /// Return the diagonal direction between two cardinal directions. + /// public static Direction GetDiagonalBetweenTwoCardinals(Direction cardinal1, Direction cardinal2) { List givenCardinals = new List { cardinal1, cardinal2 }; @@ -98,6 +113,9 @@ public static Direction GetDiagonalBetweenTwoCardinals(Direction cardinal1, Dire givenCardinals.Contains(Direction.West) ? Direction.NorthWest : Direction.NorthEast; } + /// + /// Return the cardinal direction between two diagonal directions. + /// public static Direction GetCardinalBetweenTwoDiagonals(Direction diagonal1, Direction diagonal2) { List givenDiagonals = new List { diagonal1, diagonal2 }; @@ -106,11 +124,18 @@ public static Direction GetCardinalBetweenTwoDiagonals(Direction diagonal1, Dire givenDiagonals.Contains(Direction.SouthWest) ? Direction.West : Direction.North; } + /// + /// Return the angle between two directions, clock wise is positive. + /// public static float AngleBetween(Direction from, Direction to) { return ((int)to - (int)from) * 45.0f; } + /// + /// Get the opposite direction from the one in parameter. + /// E.g : North opposite is south. South-East opposite is North-West. + /// public static Direction GetOpposite(Direction direction) { return (Direction)(((int)direction + 4) % 8); @@ -121,6 +146,7 @@ public static Direction GetOpposite(Direction direction) /// a particular direction. /// e.g If the original one is facing north, return (0,1), because, the tile in front of the original /// one will be just north of the original one (hence plus one on the y axis). + /// TODO : isn't "to cardinal vector" method doing the same thing ? /// public static Vector2Int CoordinateDifferenceInFrontFacingDirection(Direction direction) { diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/GhostManager.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/GhostManager.cs index ae76dcecb3..a3202070ef 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/GhostManager.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/GhostManager.cs @@ -1,4 +1,4 @@ -using Coimbra; +using Coimbra; using UnityEngine; using Actor = SS3D.Core.Behaviours.Actor; @@ -108,7 +108,7 @@ public void ChangeGhostColor(BuildMatMode mode) public void SetNextRotation() { - Dir = TileHelper.GetNextDir(Dir); + Dir = TileHelper.GetNextCardinalDir(Dir); } } } \ No newline at end of file From 385a822844a1283a488bb64830be6c0240f35b52 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 10 Oct 2023 12:28:08 +0200 Subject: [PATCH 21/87] fixing disposal pipes --- .../Models/Structures/Pipes/DisposalPipes.fbx | Bin 63212 -> 63212 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx b/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx index 912cfe6e8a78cda70d40e398231d06eeb6ca982d..da9a1ce09470623c882eece55713c262ebaaed59 100644 GIT binary patch delta 24018 zcmZs>2|QHc+Xie#k`xI^mPy;Rl9ZjXB$b#-k}Ok}6lLF;IrcTAsq7?)Y*Qio3`t~{ zeI5H?n89F-nK9oqz3=z`f8XytKWC1)<~-*-=Xvh?zOLs!_tG-=(lYm}twVdcxVVHs zTwLrwE*|#Ief6>L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ys@C)8Xqz~^SsW%@c zZQ^|xg-f+v`l1m#P&M1hFP8FQ&Ru+%GXly%oXLEc^Bx33oV9$I^S)q)^B<$%(;H}4+=QtKADdG3IcTY8bH5x2b>Cwj12sKiw;fqS9G>$sc>3auJ} zt9S~!jcof!u*SIO!xyx^%rEyx1bPI8dIW^-gmOA7!KRUav<0yf)EoVEaYiIIja1sn_XWM6RF$` Date: Tue, 10 Oct 2023 22:14:35 +0200 Subject: [PATCH 22/87] make disposal pipe connect to disposal stuff --- .../Machines/Supply/DisposalBin.prefab | 45 ++- .../Machines/Supply/DisposalOutlet.prefab | 42 +-- .../Pipes/Disposals/DisposalPipes.prefab | 342 ++++++++++++++++-- .../SS3D/Systems/Furniture/DisposalBin.cs | 14 + .../Systems/Furniture/DisposalBin.cs.meta | 11 + .../SS3D/Systems/Furniture/DisposalOutlet.cs | 14 + .../Systems/Furniture/DisposalOutlet.cs.meta | 11 + .../Systems/Furniture/IDisposalElement.cs | 12 + .../Furniture/IDisposalElement.cs.meta | 11 + .../AbstractHorizontalConnector.cs | 2 +- .../Tile/Connections/AdjacencyShape.cs | 2 + .../AdjacencyTypes/PipeAdjacency.cs | 123 +++++++ .../AdjacencyTypes/PipeAdjacency.cs.meta | 11 + .../DisposalPipeAdjacencyConnector.cs | 220 +++++++++++ .../DisposalPipeAdjacencyConnector.cs.meta | 11 + Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 2 +- 16 files changed, 796 insertions(+), 77 deletions(-) create mode 100644 Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs create mode 100644 Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs create mode 100644 Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs create mode 100644 Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs.meta diff --git a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab index 05a1d80bbe..670f3861bb 100644 --- a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab +++ b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 2658310835758749971} - component: {fileID: 7849163769786431713} - component: {fileID: 1871071288925904272} + - component: {fileID: 834667898589736169} m_Layer: 0 m_Name: DisposalBin m_TagString: Untagged @@ -114,40 +115,36 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: - - {fileID: 0} + k__BackingField: {fileID: 0} + _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} k__BackingField: 2 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 11648922087473007400 - _sceneNetworkObjects: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 1871071288925904272} - - {fileID: 0} +--- !u!114 &834667898589736169 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2658310835758749969} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 05bf3c848b84c3b4db8ad292b49badf5, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &3330818021912189620 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab index 9b9c8f52a3..b2377ac60d 100644 --- a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab +++ b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 2658310835758749971} - component: {fileID: 7849163769786431713} - component: {fileID: 1871071288925904272} + - component: {fileID: 2869317171787391012} m_Layer: 0 m_Name: DisposalOutlet m_TagString: Untagged @@ -115,39 +116,36 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} k__BackingField: 2 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 18291103587987570784 - _sceneNetworkObjects: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 1871071288925904272} - - {fileID: 0} +--- !u!114 &2869317171787391012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2658310835758749969} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6b76aa9296aa20945be463a65f9e41b4, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &4356345215162223831 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab index 9cef843cae..b8a28a7db5 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab @@ -10,9 +10,7 @@ GameObject: m_Component: - component: {fileID: 4823056202419996052} - component: {fileID: -7727686409064562107} - - component: {fileID: -1074477776341974781} - - component: {fileID: -4998431523760016775} - - component: {fileID: 1729570281371340860} + - component: {fileID: 355159483773011154} m_Layer: 0 m_Name: DisposalPipes m_TagString: Untagged @@ -31,7 +29,11 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 5372635079475318011} + - {fileID: 1304632296797413523} + - {fileID: 1998967971414201473} + - {fileID: 9124324413506640243} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -51,7 +53,7 @@ MonoBehaviour: k__BackingField: 0 k__BackingField: {fileID: 0} _networkBehaviours: - - {fileID: 1729570281371340860} + - {fileID: 0} k__BackingField: {fileID: 0} k__BackingField: [] SerializedTransformProperties: @@ -68,21 +70,245 @@ MonoBehaviour: _scenePathHash: 0 k__BackingField: 0 k__BackingField: 18330170179948219730 ---- !u!33 &-1074477776341974781 -MeshFilter: +--- !u!114 &355159483773011154 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2802364579275783218} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9443ab9f38dffb74faddb22b6ed38d2c, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 + _addedNetworkObject: {fileID: -7727686409064562107} + _networkObjectCache: {fileID: 0} + _pipeAdjacency: + o: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + u: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + i: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + l: {fileID: -7002929985465626668, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + t: {fileID: 7767200051770316982, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + x: {fileID: -7993494061914831054, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + verticalMesh: {fileID: -6523086812048633060, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + _verticalConnection: 0 + _syncedConnections: 0 +--- !u!1 &2921518019414602032 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1998967971414201473} + - component: {fileID: 7464676210236304092} + - component: {fileID: 7611436987726591712} + m_Layer: 0 + m_Name: Disposal3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1998967971414201473 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2921518019414602032} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4823056202419996052} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &7464676210236304092 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2921518019414602032} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &7611436987726591712 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2921518019414602032} + m_Mesh: {fileID: 0} +--- !u!1 &4171428647129982559 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1304632296797413523} + - component: {fileID: 6201482601325061296} + - component: {fileID: 3574773212546457757} + m_Layer: 0 + m_Name: Disposal2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1304632296797413523 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4171428647129982559} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4823056202419996052} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &6201482601325061296 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4171428647129982559} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &3574773212546457757 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4171428647129982559} + m_Mesh: {fileID: 0} +--- !u!1 &8602689170402263917 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5372635079475318011} + - component: {fileID: 4529554255918434919} + - component: {fileID: 6218853486968285847} + m_Layer: 0 + m_Name: Disposal1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5372635079475318011 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8602689170402263917} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4823056202419996052} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &4529554255918434919 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8602689170402263917} m_Mesh: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} ---- !u!23 &-4998431523760016775 +--- !u!23 &6218853486968285847 MeshRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2802364579275783218} + m_GameObject: {fileID: 8602689170402263917} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 1 @@ -118,28 +344,86 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &1729570281371340860 -MonoBehaviour: +--- !u!1 &8703955908378342084 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2802364579275783218} + serializedVersion: 6 + m_Component: + - component: {fileID: 9124324413506640243} + - component: {fileID: 7425978706550481061} + - component: {fileID: 2731917978778670106} + m_Layer: 0 + m_Name: Disposal4 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &9124324413506640243 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8703955908378342084} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4823056202419996052} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &7425978706550481061 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8703955908378342084} m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: bc6615260753fbd48af09343d5d55332, type: 3} - m_Name: - m_EditorClassIdentifier: - _componentIndexCache: 0 - _addedNetworkObject: {fileID: -7727686409064562107} - _networkObjectCache: {fileID: -7727686409064562107} - _genericType: 1 - _specificType: 0 - _syncedConnections: 0 - simpleAdjacency: - o: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} - u: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} - i: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} - l: {fileID: -7002929985465626668, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} - t: {fileID: 7767200051770316982, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} - x: {fileID: -7993494061914831054, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &2731917978778670106 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8703955908378342084} + m_Mesh: {fileID: 0} diff --git a/Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs b/Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs new file mode 100644 index 0000000000..1c6315a330 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs @@ -0,0 +1,14 @@ +using SS3D.Interactions.Interfaces; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace SS3D.Systems.Furniture +{ + /// Currently a simple script to spot disposal Bins. + public class DisposalBin : MonoBehaviour, IDisposalElement + { + public GameObject GameObject => gameObject; + } +} diff --git a/Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs.meta b/Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs.meta new file mode 100644 index 0000000000..773a74a705 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Furniture/DisposalBin.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05bf3c848b84c3b4db8ad292b49badf5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs b/Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs new file mode 100644 index 0000000000..7596127c79 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Furniture +{ + /// + /// Currently a simple script to spot disposal outlets. + /// + public class DisposalOutlet : MonoBehaviour, IDisposalElement + { + public GameObject GameObject => gameObject; + } +} diff --git a/Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs.meta b/Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs.meta new file mode 100644 index 0000000000..03cc240274 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Furniture/DisposalOutlet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b76aa9296aa20945be463a65f9e41b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs b/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs new file mode 100644 index 0000000000..30f200c03c --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs @@ -0,0 +1,12 @@ +using SS3D.Interactions.Interfaces; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Furniture +{ + public interface IDisposalElement : IGameObjectProvider + { + + } +} diff --git a/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs.meta b/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs.meta new file mode 100644 index 0000000000..5b8e20677e --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c89bf766dbee52e4bbbe40a708677506 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index f83765f91d..cac863eca1 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -137,7 +137,7 @@ private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) } - protected void UpdateMeshAndDirection() + protected virtual void UpdateMeshAndDirection() { // Some connectors might not have to update mesh or direction at all. // E.g : door connectors. diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs index e142006ce0..de6d7625b4 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs @@ -36,5 +36,7 @@ public enum AdjacencyShape TNorthSouthWest, TNorthSouthEast, TSouthWestEast, + //Vertical + Vertical, } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs new file mode 100644 index 0000000000..b7b31cad6d --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs @@ -0,0 +1,123 @@ +using System; +using UnityEngine; + +namespace SS3D.Systems.Tile.Connections.AdjacencyTypes +{ + /// + /// + /// + [Serializable] + public struct DisposalPipeConnector + { + [Tooltip("Just set I shape for pipes")] + public Mesh o; + + [Tooltip("Just set I shape for pipes")] + public Mesh u; + + [Tooltip("A mesh where the South & south edges are connected")] + public Mesh i; + [Tooltip("A mesh where the South & West edges are connected")] + public Mesh l; + [Tooltip("A mesh where the South, West, and west edges are connected")] + public Mesh t; + [Tooltip("A mesh where all edges are connected")] + public Mesh x; + [Tooltip("A mesh where the South & south edges are connected")] + public Mesh verticalMesh; + + public MeshDirectionInfo[] GetMeshesAndDirections(AdjacencyMap adjacencyMap, bool vertical) + { + // Determine rotation and mesh specially for every single case. + float[] rotation; + Mesh[] mesh; + + AdjacencyShape shape = GetPipeShape(adjacencyMap, vertical); + switch (shape) + { + case AdjacencyShape.Vertical: + mesh = new Mesh[adjacencyMap.CardinalConnectionCount]; + rotation = new float[adjacencyMap.CardinalConnectionCount]; + int j = 0; + foreach (Direction dir in TileHelper.CardinalDirections()) + { + if (!adjacencyMap.HasConnection(dir)) continue; + mesh[j] = verticalMesh; + rotation[j] = TileHelper.AngleBetween(Direction.North, dir); + j++; + } + break; + + case AdjacencyShape.O: + mesh = new Mesh[] { o }; + rotation = new float[] { 0 }; + break; + case AdjacencyShape.U: + mesh = new Mesh[] { u }; + rotation = new float[1] { TileHelper.AngleBetween(Direction.North, + adjacencyMap.GetSingleConnection()) }; + break; + + case AdjacencyShape.I: + mesh = new Mesh[] { i }; + rotation = new float[1] { TileHelper.AngleBetween(Direction.North, + adjacencyMap.HasConnection(Direction.South) ? Direction.South : Direction.West) }; + break; + case AdjacencyShape.L: + mesh = new Mesh[] { l }; + rotation = new float[] { TileHelper.AngleBetween(Direction.NorthEast, + adjacencyMap.GetDirectionBetweenTwoConnections()) }; + break; + case AdjacencyShape.T: + mesh = new Mesh[] { t }; + rotation = new float[] { TileHelper.AngleBetween(Direction.North, adjacencyMap.GetSingleNonConnection()) }; + break; + case AdjacencyShape.X: + mesh = new Mesh[] { x }; + rotation = new float[] { 0 }; + break; + default: + Debug.LogError($"Received unexpected shape from simple shape resolver: {shape}"); + mesh = new Mesh[] { i }; + rotation = new float[] { 0 }; + break; + } + + MeshDirectionInfo[] MeshesAndDirections = new MeshDirectionInfo[mesh.Length]; + + for(int i=0; i< mesh.Length; i++) + { + MeshesAndDirections[i] = new MeshDirectionInfo { Mesh = mesh[i], Rotation = rotation[i] }; + } + + return MeshesAndDirections; + } + + private AdjacencyShape GetPipeShape(AdjacencyMap adjacencyMap, bool vertical) + { + if (vertical) return AdjacencyShape.Vertical; + + int connectionCount = adjacencyMap.CardinalConnectionCount; + + switch (connectionCount) + { + case 0: + return AdjacencyShape.O; + case 1: + return AdjacencyShape.U; + //When two connections, checks if they're opposite or adjacent + case 2: + return adjacencyMap.HasConnection(Direction.North) + == adjacencyMap.HasConnection(Direction.South) ? + AdjacencyShape.I : AdjacencyShape.L; + case 3: + return AdjacencyShape.T; + case 4: + return AdjacencyShape.X; + default: + Debug.LogError($"Could not resolve Simple Adjacency Shape for given Adjacency Map - {adjacencyMap}"); + return AdjacencyShape.I; + } + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs.meta new file mode 100644 index 0000000000..ed97ad8e5e --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 779abd1d92814f045ad9277b973517b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs new file mode 100644 index 0000000000..a47eff9f53 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -0,0 +1,220 @@ +using FishNet.Object.Synchronizing; +using SS3D.Core; +using SS3D.Core.Behaviours; +using SS3D.Interactions.Interfaces; +using SS3D.Logging; +using SS3D.Systems.Furniture; +using SS3D.Systems.Tile.Connections; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Tile.Connections + +{ + public class DisposalPipeAdjacencyConnector : NetworkActor, IAdjacencyConnector + { + [SerializeField] private DisposalPipeConnector _pipeAdjacency; + + protected AdjacencyMap _adjacencyMap; + + [SyncVar(OnChange = nameof(SyncVertical))] + protected bool _verticalConnection; + + protected MeshFilter[] _filters = new MeshFilter[4]; + + protected PlacedTileObject _placedObject; + + public PlacedTileObject PlacedObject => _placedObject; + + [SyncVar(OnChange = nameof(SyncAdjacencies))] + private byte _syncedConnections; + + private bool _initialized; + + protected TileObjectSpecificType _specificType; + + + private void Setup() + { + if (!_initialized) + { + _adjacencyMap = new AdjacencyMap(); + _filters = GetComponentsInChildren(); + + _placedObject = GetComponent(); + if (_placedObject == null) + { + _specificType = TileObjectSpecificType.None; + } + else + { + _specificType = _placedObject.SpecificType; + } + _initialized = true; + } + } + + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + if (neighbourObject == null) return false; + + TileSystem tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + + TryGetDisposalElementAbovePipe(out var aboveDisposalElement); + + if(neighbourObject.TryGetComponent(out var neighbourElement) + && neighbourElement == aboveDisposalElement) + { + return true; + } + + bool isConnected; + isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected &= neighbourObject.SpecificType == _specificType; + return isConnected; + } + + private bool TryGetDisposalElementAbovePipe(out IDisposalElement disposalOutlet) + { + TileSystem tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + + TileChunk currentChunk = map.GetChunk(_placedObject.gameObject.transform.position); + var furnitureLocation = currentChunk.GetTileObject(TileLayer.FurnitureBase, _placedObject.Origin.x, _placedObject.Origin.y); + disposalOutlet = furnitureLocation.PlacedObject?.GetComponent(); + + return disposalOutlet != null; + } + + /// + /// Update a single connection, in a specific direction. Eventually also update the neighbour connection. + /// + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + { + Setup(); + + bool isConnected = IsConnected(dir, neighbourObject); + + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + + bool isUpdated; + bool isVertical; + + if(neighbourObject != null) + { + if (neighbourObject.GetComponent() != null) + { + isVertical = true; + isUpdated = _verticalConnection != isVertical; + } + else + { + isVertical = false; + isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + } + + if (isUpdated && !isVertical) + { + _syncedConnections = _adjacencyMap.SerializeToByte(); + UpdateMeshAndDirection(); + } + + if (isUpdated && isVertical) + { + _verticalConnection = isVertical; + UpdateMeshAndDirection(); + } + + return isUpdated; + } + + + isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + if (isUpdated) + { + UpdateMeshAndDirection(); + } + + return isUpdated; + } + + // TODO : maybe interface should let updateAllconnections handle retrieving neighbours + // object, as it might not mean the same thing for different connectors. + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + { + Setup(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); + } + + if(TryGetDisposalElementAbovePipe(out IDisposalElement disposalElement)) + { + var placedDisposal = disposalElement.GameObject.GetComponent(); + changed |= UpdateSingleConnection(0, placedDisposal, false); + } + + if (changed) + { + UpdateMeshAndDirection(); + } + } + + protected virtual void UpdateMeshAndDirection() + { + var infos = _pipeAdjacency.GetMeshesAndDirections(_adjacencyMap, _verticalConnection); + transform.localRotation = Quaternion.identity; + + int i = 0; + foreach(var info in infos) + { + _filters[i].transform.localPosition = Vector3.zero; + if (info.Mesh == _pipeAdjacency.verticalMesh) + { + _filters[i].transform.localPosition -= new Vector3(0,0.67f,0); + } + _filters[i].mesh = info.Mesh; + Quaternion localRotation = _filters[i].transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); + _filters[i].transform.localRotation = localRotation; + i++; + } + } + + /// + /// Sync adjacency map on client, and update mesh and direction using this new map. + /// + private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) + { + if (!asServer) + { + Setup(); + + _adjacencyMap.DeserializeFromByte(newValue); + UpdateMeshAndDirection(); + } + } + + /// + /// Sync adjacency map on client, and update mesh and direction using this new map. + /// + private void SyncVertical(bool oldValue, bool newValue, bool asServer) + { + if (!asServer) + { + Setup(); + + _verticalConnection = newValue; + UpdateMeshAndDirection(); + } + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs.meta new file mode 100644 index 0000000000..4915110339 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9443ab9f38dffb74faddb22b6ed38d2c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index d4e8c1019b..4043de5f7a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -94,7 +94,7 @@ private TileChunk GetOrCreateChunk(Vector3 worldPosition) return chunk; } - private TileChunk GetChunk(Vector3 worldPosition) + public TileChunk GetChunk(Vector3 worldPosition) { Vector2Int key = GetKey(worldPosition); From 5422a116fb1c9fd6b8956abb0bd4d485d2b3e358 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 14 Oct 2023 21:20:21 +0200 Subject: [PATCH 23/87] remove multiple mesh on disposal pipe --- .../AdjacencyTypes/PipeAdjacency.cs | 56 +++++++------------ .../DisposalPipeAdjacencyConnector.cs | 27 ++++----- 2 files changed, 30 insertions(+), 53 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs index b7b31cad6d..91ce814736 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs @@ -26,71 +26,53 @@ public struct DisposalPipeConnector [Tooltip("A mesh where the South & south edges are connected")] public Mesh verticalMesh; - public MeshDirectionInfo[] GetMeshesAndDirections(AdjacencyMap adjacencyMap, bool vertical) + public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap, bool vertical) { // Determine rotation and mesh specially for every single case. - float[] rotation; - Mesh[] mesh; + float rotation = 0; + Mesh mesh; AdjacencyShape shape = GetPipeShape(adjacencyMap, vertical); switch (shape) { case AdjacencyShape.Vertical: - mesh = new Mesh[adjacencyMap.CardinalConnectionCount]; - rotation = new float[adjacencyMap.CardinalConnectionCount]; - int j = 0; - foreach (Direction dir in TileHelper.CardinalDirections()) - { - if (!adjacencyMap.HasConnection(dir)) continue; - mesh[j] = verticalMesh; - rotation[j] = TileHelper.AngleBetween(Direction.North, dir); - j++; - } + mesh = verticalMesh; break; case AdjacencyShape.O: - mesh = new Mesh[] { o }; - rotation = new float[] { 0 }; + mesh = o ; break; case AdjacencyShape.U: - mesh = new Mesh[] { u }; - rotation = new float[1] { TileHelper.AngleBetween(Direction.North, - adjacencyMap.GetSingleConnection()) }; + mesh = u ; + rotation = TileHelper.AngleBetween(Direction.North, adjacencyMap.GetSingleConnection()); break; case AdjacencyShape.I: - mesh = new Mesh[] { i }; - rotation = new float[1] { TileHelper.AngleBetween(Direction.North, - adjacencyMap.HasConnection(Direction.South) ? Direction.South : Direction.West) }; + mesh = i ; + rotation = TileHelper.AngleBetween(Direction.North, + adjacencyMap.HasConnection(Direction.South) ? Direction.South : Direction.West); break; case AdjacencyShape.L: - mesh = new Mesh[] { l }; - rotation = new float[] { TileHelper.AngleBetween(Direction.NorthEast, - adjacencyMap.GetDirectionBetweenTwoConnections()) }; + mesh = l ; + rotation = TileHelper.AngleBetween(Direction.NorthEast, + adjacencyMap.GetDirectionBetweenTwoConnections()); break; case AdjacencyShape.T: - mesh = new Mesh[] { t }; - rotation = new float[] { TileHelper.AngleBetween(Direction.North, adjacencyMap.GetSingleNonConnection()) }; + mesh = t ; + rotation = TileHelper.AngleBetween(Direction.North, adjacencyMap.GetSingleNonConnection()); break; case AdjacencyShape.X: - mesh = new Mesh[] { x }; - rotation = new float[] { 0 }; + mesh = x ; break; default: Debug.LogError($"Received unexpected shape from simple shape resolver: {shape}"); - mesh = new Mesh[] { i }; - rotation = new float[] { 0 }; + mesh = i ; break; } - MeshDirectionInfo[] MeshesAndDirections = new MeshDirectionInfo[mesh.Length]; + MeshDirectionInfo MeshAndDirection = new MeshDirectionInfo { Mesh = mesh, Rotation = rotation } ; - for(int i=0; i< mesh.Length; i++) - { - MeshesAndDirections[i] = new MeshDirectionInfo { Mesh = mesh[i], Rotation = rotation[i] }; - } - - return MeshesAndDirections; + return MeshAndDirection; } private AdjacencyShape GetPipeShape(AdjacencyMap adjacencyMap, bool vertical) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index a47eff9f53..a511edc8d3 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -22,7 +22,7 @@ public class DisposalPipeAdjacencyConnector : NetworkActor, IAdjacencyConnector [SyncVar(OnChange = nameof(SyncVertical))] protected bool _verticalConnection; - protected MeshFilter[] _filters = new MeshFilter[4]; + protected MeshFilter _filter; protected PlacedTileObject _placedObject; @@ -41,7 +41,7 @@ private void Setup() if (!_initialized) { _adjacencyMap = new AdjacencyMap(); - _filters = GetComponentsInChildren(); + _filter = GetComponent(); _placedObject = GetComponent(); if (_placedObject == null) @@ -169,24 +169,19 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) protected virtual void UpdateMeshAndDirection() { - var infos = _pipeAdjacency.GetMeshesAndDirections(_adjacencyMap, _verticalConnection); + var info = _pipeAdjacency.GetMeshAndDirection(_adjacencyMap, _verticalConnection); transform.localRotation = Quaternion.identity; + _filter.transform.localPosition = Vector3.zero; - int i = 0; - foreach(var info in infos) + if (info.Mesh == _pipeAdjacency.verticalMesh) { - _filters[i].transform.localPosition = Vector3.zero; - if (info.Mesh == _pipeAdjacency.verticalMesh) - { - _filters[i].transform.localPosition -= new Vector3(0,0.67f,0); - } - _filters[i].mesh = info.Mesh; - Quaternion localRotation = _filters[i].transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); - _filters[i].transform.localRotation = localRotation; - i++; + _filter.transform.localPosition -= new Vector3(0,0.67f,0); } + _filter.mesh = info.Mesh; + Quaternion localRotation = _filter.transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); + _filter.transform.localRotation = localRotation; } /// From 05d84dc2a54927ed1afe341b8c0f36f8fc8037b8 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 14 Oct 2023 22:35:00 +0200 Subject: [PATCH 24/87] fix position --- .../Pipes/Disposals/DisposalPipes.prefab | 304 +----------------- .../DisposalPipeAdjacencyConnector.cs | 10 +- 2 files changed, 18 insertions(+), 296 deletions(-) diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab index b8a28a7db5..7f718fe5b0 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab @@ -11,6 +11,8 @@ GameObject: - component: {fileID: 4823056202419996052} - component: {fileID: -7727686409064562107} - component: {fileID: 355159483773011154} + - component: {fileID: 1702746743542006300} + - component: {fileID: 6841799689541215485} m_Layer: 0 m_Name: DisposalPipes m_TagString: Untagged @@ -29,11 +31,7 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 5372635079475318011} - - {fileID: 1304632296797413523} - - {fileID: 1998967971414201473} - - {fileID: 9124324413506640243} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -53,7 +51,7 @@ MonoBehaviour: k__BackingField: 0 k__BackingField: {fileID: 0} _networkBehaviours: - - {fileID: 0} + - {fileID: 355159483773011154} k__BackingField: {fileID: 0} k__BackingField: [] SerializedTransformProperties: @@ -82,9 +80,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9443ab9f38dffb74faddb22b6ed38d2c, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 0 _addedNetworkObject: {fileID: -7727686409064562107} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: -7727686409064562107} _pipeAdjacency: o: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} u: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} @@ -95,295 +93,21 @@ MonoBehaviour: verticalMesh: {fileID: -6523086812048633060, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} _verticalConnection: 0 _syncedConnections: 0 ---- !u!1 &2921518019414602032 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1998967971414201473} - - component: {fileID: 7464676210236304092} - - component: {fileID: 7611436987726591712} - m_Layer: 0 - m_Name: Disposal3 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1998967971414201473 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2921518019414602032} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 4823056202419996052} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!23 &7464676210236304092 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2921518019414602032} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &7611436987726591712 +--- !u!33 &1702746743542006300 MeshFilter: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2921518019414602032} - m_Mesh: {fileID: 0} ---- !u!1 &4171428647129982559 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1304632296797413523} - - component: {fileID: 6201482601325061296} - - component: {fileID: 3574773212546457757} - m_Layer: 0 - m_Name: Disposal2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1304632296797413523 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4171428647129982559} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 4823056202419996052} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!23 &6201482601325061296 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4171428647129982559} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &3574773212546457757 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4171428647129982559} - m_Mesh: {fileID: 0} ---- !u!1 &8602689170402263917 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5372635079475318011} - - component: {fileID: 4529554255918434919} - - component: {fileID: 6218853486968285847} - m_Layer: 0 - m_Name: Disposal1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &5372635079475318011 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8602689170402263917} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 4823056202419996052} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &4529554255918434919 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8602689170402263917} + m_GameObject: {fileID: 2802364579275783218} m_Mesh: {fileID: -6725049071555871357, guid: 8fa7941da6a6a8d4da717a97b11b2621, type: 3} ---- !u!23 &6218853486968285847 +--- !u!23 &6841799689541215485 MeshRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8602689170402263917} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!1 &8703955908378342084 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 9124324413506640243} - - component: {fileID: 7425978706550481061} - - component: {fileID: 2731917978778670106} - m_Layer: 0 - m_Name: Disposal4 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &9124324413506640243 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8703955908378342084} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 4823056202419996052} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!23 &7425978706550481061 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8703955908378342084} + m_GameObject: {fileID: 2802364579275783218} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 1 @@ -419,11 +143,3 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &2731917978778670106 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8703955908378342084} - m_Mesh: {fileID: 0} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index a511edc8d3..03e0da4142 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -171,11 +171,17 @@ protected virtual void UpdateMeshAndDirection() { var info = _pipeAdjacency.GetMeshAndDirection(_adjacencyMap, _verticalConnection); transform.localRotation = Quaternion.identity; - _filter.transform.localPosition = Vector3.zero; + + var pos = transform.position; if (info.Mesh == _pipeAdjacency.verticalMesh) { - _filter.transform.localPosition -= new Vector3(0,0.67f,0); + transform.position = new Vector3(pos.x, -0.67f, pos.z); + } + else if (_filter.mesh == _pipeAdjacency.verticalMesh) + { + transform.position = new Vector3(pos.x, 0f, pos.z); + return; } _filter.mesh = info.Mesh; Quaternion localRotation = _filter.transform.localRotation; From 65ff6e93af2e7ad947e01e4b9ff4db0cb3ffaad4 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 17 Oct 2023 14:57:45 +0200 Subject: [PATCH 25/87] fix some stuff for disposal --- .../Systems/Tile/Connections/AdjacencyMap.cs | 2 +- .../DisposalPipeAdjacencyConnector.cs | 43 ++++++++++++++++--- .../Tile/PlacedObjects/PlacedTileObject.cs | 5 +++ .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 22 ++++++++-- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 2 +- 5 files changed, 63 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs index c65357ddc5..8db9107184 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs @@ -106,7 +106,7 @@ public bool SetConnection(Direction direction, AdjacencyData data) return changed; } - private List GetAdjacencies(bool cardinal) + public List GetAdjacencies(bool cardinal) { //Are we getting adjacencies for cardinal or diagonal directions? List directionIndexes = cardinal ? diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 03e0da4142..8333c703e7 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -35,6 +35,8 @@ public class DisposalPipeAdjacencyConnector : NetworkActor, IAdjacencyConnector protected TileObjectSpecificType _specificType; + private bool _isVertical = false; + private void Setup() { @@ -172,20 +174,37 @@ protected virtual void UpdateMeshAndDirection() var info = _pipeAdjacency.GetMeshAndDirection(_adjacencyMap, _verticalConnection); transform.localRotation = Quaternion.identity; - var pos = transform.position; + Vector3 pos = transform.position; + Quaternion localRotation = _filter.transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + _filter.mesh = info.Mesh; if (info.Mesh == _pipeAdjacency.verticalMesh) { + _isVertical= true; transform.position = new Vector3(pos.x, -0.67f, pos.z); + _filter.transform.localRotation = Quaternion.Euler(eulerRotation.x, TileHelper.GetRotationAngle(_placedObject.Direction), eulerRotation.z); + + if (!_isVertical) + { + var directions = TileHelper.AllDirections(); + directions.Remove(TileHelper.GetOpposite(_placedObject.Direction)); + SetBlockedDirection(directions, false); + + } + + return; } else if (_filter.mesh == _pipeAdjacency.verticalMesh) { transform.position = new Vector3(pos.x, 0f, pos.z); - return; } - _filter.mesh = info.Mesh; - Quaternion localRotation = _filter.transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; + + if (info.Mesh != _pipeAdjacency.verticalMesh) + { + _isVertical = false; + } + localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); _filter.transform.localRotation = localRotation; } @@ -217,5 +236,19 @@ private void SyncVertical(bool oldValue, bool newValue, bool asServer) UpdateMeshAndDirection(); } } + + /// + /// Sets a given direction blocked or unblocked. + /// If blocked, this means that it will no longer be allowed to connect on that direction (until further update). + /// + private void SetBlockedDirection(List directions, bool value) + { + foreach(var dir in directions) + { + _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); + } + + UpdateMeshAndDirection(); + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index aab39d1eb6..9a05ee2732 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -123,6 +123,11 @@ public SavedPlacedTileObject Save() }; } + public void SetDirection(Direction dir) + { + _dir = dir; + } + /// /// Is this in front of the other object ? /// diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index 0be84c9200..bac5d6d31d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using UnityEngine; +using SS3D.Utils; namespace SS3D.Systems.Tile { @@ -57,6 +58,12 @@ public static TileLayer[] GetTileLayers() return TileLayers; } + public static Tuple GetAdjacentDirections(Direction dir) + { + return new Tuple( (Direction) MathUtility.mod((int) dir + 1, 8), + (Direction)MathUtility.mod((int)dir - 1, 8) ); + } + /// /// Get the offset in coordinates in a given direction. /// @@ -78,12 +85,10 @@ public static Vector3 GetClosestPosition(Vector3 worldPosition) /// /// Get the relative direction between two direction. - /// E.g : to = North-East, from = South-West, return South. - /// TODO : maybe swith name of to and from, currently it feels it's the inverse way around. /// - public static Direction GetRelativeDirection(Direction to, Direction from) + public static Direction GetRelativeDirection(Direction from, Direction to) { - return (Direction)((((int)to - (int)from) + 8) % 8); + return (Direction)((((int)from - (int)to) + 8) % 8); } /// @@ -94,6 +99,15 @@ public static List CardinalDirections() return new List { Direction.North, Direction.East, Direction.South, Direction.West }; } + /// + /// Return a list of the cardinal directions. + /// + public static List AllDirections() + { + return new List { Direction.North, Direction.NorthEast, Direction.East, Direction.SouthEast, + Direction.South, Direction.SouthWest, Direction.West, Direction.NorthWest }; + } + /// /// Return a list of the diagonal directions. /// diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index 4043de5f7a..c9a04da15b 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -108,7 +108,7 @@ public TileChunk GetChunk(Vector3 worldPosition) } } - private TileObject GetTileObject(TileLayer layer, Vector3 worldPosition) + public TileObject GetTileObject(TileLayer layer, Vector3 worldPosition) { TileChunk chunk = GetOrCreateChunk(worldPosition); // TODO: creates unnessary empty chunk when checking whether building can be done return chunk.GetTileObject(layer, worldPosition); From c430ba71782527587834a08634f6e671c834e8cd Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 17 Oct 2023 14:58:38 +0200 Subject: [PATCH 26/87] Partly make dinnerbooth work --- .../Furniture/Generic/Seats/DinerBooth.fbx | Bin 0 -> 55340 bytes .../Generic/Seats/DinerBooth.fbx.meta | 106 ++++++++++ .../Furniture/Generic/Seats/DinnerBooth.asset | 22 +++ .../Generic/Seats/DinnerBooth.asset.meta | 8 + .../Generic/Seats/DinnerBooth.prefab | 142 ++++++++++++++ .../Generic/Seats/DinnerBooth.prefab.meta | 7 + .../Tile/Connections/AdjacencyShape.cs | 5 + .../DirectionnalShapeResolver.cs | 182 ++++++++++++++++++ .../DirectionnalShapeResolver.cs.meta | 11 ++ .../DirectionnalAdjacencyConnector.cs | 181 +++++++++++++++++ .../DirectionnalAdjacencyConnector.cs.meta | 11 ++ 11 files changed, 675 insertions(+) create mode 100644 Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx create mode 100644 Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta create mode 100644 Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset create mode 100644 Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset.meta create mode 100644 Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab create mode 100644 Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab.meta create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs.meta create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs.meta diff --git a/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx b/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx new file mode 100644 index 0000000000000000000000000000000000000000..8480374ba32015f96b50abf1f4bd705f617ecaba GIT binary patch literal 55340 zcmbqc2|U!>7gu(YBvE17RSKn&Wk|M4_G}SZ#*$?)WNf3d6-wGHS(1v%l1j)jmXK_T zQ1*Q{wlSC){`Y65(tGiG@BjPsGrzg_p6@;P+;h)4_uSvSr)=V8ZsKIJRq=%0))UtD zCQfc!x6*8;>F1@PF=eFrajggSClMy*2qy)!Gr}HajkGrem8-x_5AJn8s&x=fQ01v1 zS{fSkk`^qW#rHZ0JbX#rS_OMECpQOYKzG*70dWdc(OiL`sTYTw6T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|y2PAh=QjRK$pp7&5@XX~?Ja(V08 zz#Oe(HqrjE5_{ zujgcG?rv}9^7ry=EtQ|;qz~{T%X4a--#*~B!EaNh{#u||3jK+7`rTxD8(T+PM@v`N zKMJv>EM(4fP)NxmJ|GHtW%ZL()yoOy2lR`!c-I8Mko!M3AliBWQ)Z`0!fF4xUm zEurS*Y7TWekIfE38E4CJvu(S5IPCHuHvB+}#Y_h<> zuuYxf0HIavO$wCyN#JOCYyj-`dInce~5@n@GI;^b&8a#9TFI)3CKn}SXr zK6a_u+FSlegWUJ1$Qr2w>8V(H80qPWs~G+0FM#!%(H2&?P4tWxEy>GZ4@)v1M{-{O zIUfj6-Wy>{7o!XS$c3}1JHPB|`Lo;G0f4T+X{KrL;T&hR8{fo6ovl$$20{qyg3&VT%mH0Dvrm4)6miDj8qb%+2P< z8eU5eSl$DxV)BT6*@YsQ~SM(jjM!oYrn~DcL&dm^o>Z5#lJIpL+h6`svw3 z|6lY>&dcwERM)R~`m-=c$Mv4U^>q8X!pP<%sN z(KeQ*Khd857Hwn6^Aqj!Z_zg9(?8MhzeU@aru{_Y?f9Lfl_H+xPH5XtkyU?-b_S9{ zu94fcH$=AoE!xIs`m{Ghj{7az#>v&%8zR5^E!xH@aoQUq5B?Ty;~jYI4UuMgJacL((gMkG3JH|KFo+Nc!~e(KaM)_XZ(z;C1W>i!%^eogE4 z0PxLICn122+$C(S^&36aPX++SuK?TBf@sK=IoInz%tnU**xy`S$iwt6g5NzYmu2t% v{IT8YmB&gjH~t84l<}X#*bn>apX2}kh*`RJ=SDy9ap|e?Jww3vis=78l(rBD literal 0 HcmV?d00001 diff --git a/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta b/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta new file mode 100644 index 0000000000..75d9f3bc6e --- /dev/null +++ b/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta @@ -0,0 +1,106 @@ +fileFormatVersion: 2 +guid: bcf01b0847ef6d843ae7613281a81df1 +ModelImporter: + serializedVersion: 21300 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + removeConstantScaleCurves: 1 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + nodeNameCollisionStrategy: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 0 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + optimizeBones: 1 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + remapMaterialsIfMaterialImportModeIsNone: 0 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset new file mode 100644 index 0000000000..b3ae6ae014 --- /dev/null +++ b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset @@ -0,0 +1,22 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3} + m_Name: DinnerBooth + m_EditorClassIdentifier: + nameString: + prefab: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + icon: {fileID: 0} + layer: 7 + genericType: 5 + specificType: 0 + width: 1 + height: 1 diff --git a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset.meta b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset.meta new file mode 100644 index 0000000000..894faf575b --- /dev/null +++ b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: befbc886dd0869a438a66ce949a10f9a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab b/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab new file mode 100644 index 0000000000..1c77aaf50f --- /dev/null +++ b/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab @@ -0,0 +1,142 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8085678556641831659 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1750478436839435592} + - component: {fileID: 7418334817260183665} + - component: {fileID: 1740478804813226977} + - component: {fileID: 7950383285113202337} + - component: {fileID: 8031370004641457100} + m_Layer: 0 + m_Name: DinnerBooth + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1750478436839435592 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8085678556641831659} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 9.950995, y: 0.52496845, z: 0.5001033} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7418334817260183665 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8085678556641831659} + m_Mesh: {fileID: 559316708432223863, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} +--- !u!23 &1740478804813226977 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8085678556641831659} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!114 &7950383285113202337 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8085678556641831659} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 479fbe67c0de04b449f924bc5462ede3, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 0 + _addedNetworkObject: {fileID: 8031370004641457100} + _networkObjectCache: {fileID: 8031370004641457100} + AdjacencyResolver: + o: {fileID: 559316708432223863, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + uLeft: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + uRight: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + i: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + lIn: {fileID: -8550456321050019914, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + lOut: {fileID: -819412828331094011, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} +--- !u!114 &8031370004641457100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8085678556641831659} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0 + k__BackingField: {fileID: 0} + _networkBehaviours: + - {fileID: 7950383285113202337} + k__BackingField: {fileID: 0} + k__BackingField: [] + SerializedTransformProperties: + Position: {x: 9.950995, y: 0.52496845, z: 0.5001033} + Rotation: {x: 0, y: 0, z: 0, w: 1} + LocalScale: {x: 1, y: 1, z: 1} + _isNetworked: 1 + _isGlobal: 0 + _initializeOrder: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: 0 + k__BackingField: 0 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 3148903556074791268 diff --git a/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab.meta b/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab.meta new file mode 100644 index 0000000000..4b1fe376b9 --- /dev/null +++ b/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 85fa4c9b76b4b23458dcf24a745a1dfe +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs index de6d7625b4..92a9334cad 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyShape.cs @@ -38,5 +38,10 @@ public enum AdjacencyShape TSouthWestEast, //Vertical Vertical, + // Directional + LIn, + LOut, + ULeft, + URight, } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs new file mode 100644 index 0000000000..bc57d737cb --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs @@ -0,0 +1,182 @@ +using Coimbra; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Tile.Connections.AdjacencyTypes +{ + [Serializable] + public struct DirectionnalShapeResolver + { + [Tooltip("A mesh where no edges are connected")] + public Mesh o; + [Tooltip("A mesh where the South edge is connected")] + public Mesh uLeft; + [Tooltip("A mesh where the South edge is connected")] + public Mesh uRight; + [Tooltip("A mesh where the South & south edges are connected")] + public Mesh i; + [Tooltip("A mesh where the South & West edges are connected")] + public Mesh lIn; + [Tooltip("A mesh where the South & West edges are connected")] + public Mesh lOut; + [Tooltip("A mesh where the South, West, and west edges are connected")] + + ///

+ /// + /// + /// + /// + /// Neigthbours direction are only cardinal neighbours + /// + public Tuple GetMeshAndDirectionAndRotation(AdjacencyMap adjacencyMap, Direction direction, List neighboursDirection) + { + // Determine rotation and mesh specially for every single case. + float rotation = 0.0f; + Mesh mesh; + + AdjacencyShape shape = GetSimpleShape(adjacencyMap, direction, neighboursDirection); + + + switch (shape) + { + case AdjacencyShape.O: + mesh = o; + rotation = TileHelper.AngleBetween(Direction.North, direction); + break; + case AdjacencyShape.ULeft: + mesh = uLeft; + rotation = TileHelper.AngleBetween(Direction.North, direction); + break; + case AdjacencyShape.URight: + mesh = uRight; + rotation = TileHelper.AngleBetween(Direction.North, direction); + break; + case AdjacencyShape.I: + mesh = i; + rotation = TileHelper.AngleBetween(Direction.North, direction); + break; + case AdjacencyShape.LIn: + mesh = lIn; + rotation = LInRotation(adjacencyMap); + break; + case AdjacencyShape.LOut: + mesh = lOut; + rotation = LOutRotation(adjacencyMap); + break; + default: + Debug.LogError($"Received unexpected shape from simple shape resolver: {shape}"); + mesh = o; + break; + } + + return new Tuple (direction, new MeshDirectionInfo { Mesh = mesh, Rotation = rotation }); + } + + public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction dir, List NeighboursDirection) + { + int cardinalConnectionCount = adjacencyMap.CardinalConnectionCount; + switch (cardinalConnectionCount) + { + case 0: + return AdjacencyShape.O; + case 1: + var directionConnection = adjacencyMap.GetSingleConnection(true); + var relative =TileHelper.GetRelativeDirection(dir, directionConnection); + if(!NeighboursDirection.Contains(dir)) return AdjacencyShape.O; + if (relative == Direction.East) + return AdjacencyShape.ULeft; + else return AdjacencyShape.URight; + //When two connections, checks if they're opposite or adjacent + case 2: + + if (adjacencyMap.HasConnection(Direction.North) == adjacencyMap.HasConnection(Direction.South)) + return AdjacencyShape.I; + + if (IsInsideConfiguration(adjacencyMap, dir)) + return AdjacencyShape.LIn; + else + return AdjacencyShape.LOut; + + default: + Debug.LogError($"Could not resolve Simple Adjacency Shape for given Adjacency Map - {adjacencyMap}"); + return AdjacencyShape.O; + } + } + + /// + /// It's useful to draw the 8 different configuration of LIn shape + /// with 3 couch, one in the middle and two other in cardinal positions. Consider the middle couch can point towards any cardinal + /// direction. We don't care about the directions of the two other couches, what matters is their position relative to the middle one. + /// This help understand the code below. + /// + /// + /// + /// + private static bool IsInsideConfiguration(AdjacencyMap adjacencyMap, Direction dir) + { + var adjacencies = adjacencyMap.GetAdjacencies(true); + + switch (dir) + { + case Direction.North: + return adjacencies.Contains(Direction.North) && + (adjacencies.Contains(Direction.East) || adjacencies.Contains(Direction.West)); + case Direction.East: + return adjacencies.Contains(Direction.East) && + (adjacencies.Contains(Direction.North) || adjacencies.Contains(Direction.South)); + case Direction.South: + return adjacencies.Contains(Direction.South) && + (adjacencies.Contains(Direction.East) || adjacencies.Contains(Direction.West)); + case Direction.West: + return adjacencies.Contains(Direction.West) && + (adjacencies.Contains(Direction.South) || adjacencies.Contains(Direction.North)); + default: + return false; + } + } + + private static float LOutRotation(AdjacencyMap connections) + { + var adjacencies = connections.GetAdjacencies(true); + if(adjacencies.Contains(Direction.South) && adjacencies.Contains(Direction.East)) + { + return 90f; + } + + if (adjacencies.Contains(Direction.South) && adjacencies.Contains(Direction.West)) + { + return 180f; + } + + if (adjacencies.Contains(Direction.North) && adjacencies.Contains(Direction.West)) + { + return 270f; + } + + return 0f; + } + + private static float LInRotation(AdjacencyMap connections) + { + var adjacencies = connections.GetAdjacencies(true); + if (adjacencies.Contains(Direction.South) && adjacencies.Contains(Direction.East)) + { + return 90f; + } + + if (adjacencies.Contains(Direction.South) && adjacencies.Contains(Direction.West)) + { + return 180f; + } + + if (adjacencies.Contains(Direction.North) && adjacencies.Contains(Direction.West)) + { + return 270f; + } + + return 0f; + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs.meta new file mode 100644 index 0000000000..2ece84b2b2 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2470fb8500aed440a5ad3bd78b6c590 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs new file mode 100644 index 0000000000..9240537df6 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -0,0 +1,181 @@ +using FishNet.Object.Synchronizing; +using SS3D.Core; +using SS3D.Core.Behaviours; +using SS3D.Logging; +using SS3D.Systems.Tile.Connections; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using SS3D.Utils; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Tile.Connections +{ + public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector + { + + protected TileObjectGenericType _genericType; + + + protected TileObjectSpecificType _specificType; + + + public DirectionnalShapeResolver AdjacencyResolver; + + protected AdjacencyMap _adjacencyMap; + + protected MeshFilter _filter; + + protected PlacedTileObject _placedObject; + + public PlacedTileObject PlacedObject => _placedObject; + + public Direction PlacedObjectDirection => _placedObject.Direction; + + private bool _initialized; + + public override void OnStartClient() + { + base.OnStartClient(); + Setup(); + } + + /// + /// Simply set things up, including creating new references, and fetching generic and specific type + /// from the associated scriptable object. + /// + private void Setup() + { + if (!_initialized) + { + _adjacencyMap = new AdjacencyMap(); + _filter = GetComponent(); + + _placedObject = GetComponent(); + if (_placedObject == null) + { + _genericType = TileObjectGenericType.None; + _specificType = TileObjectSpecificType.None; + } + else + { + _genericType = _placedObject.GenericType; + _specificType = _placedObject.SpecificType; + } + _initialized = true; + } + } + + /// + /// directionnal are connected only with other directionnals on their right or on their left. + /// + /// + /// + /// + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + if (neighbourObject == null) return false; + + if (!TileHelper.CardinalDirections().Contains(dir)) return false; + + // add a check to see if connected to another neighbour object instead of the cardinal connection count. + + bool isConnected = true; + + if (neighbourObject.IsInFront(_placedObject) || neighbourObject.IsBehind(_placedObject)) + { + isConnected &= neighbourObject.Direction != _placedObject.Direction && + neighbourObject.Direction != TileHelper.GetOpposite(_placedObject.Direction); + } + + if (neighbourObject.IsOnLeft(_placedObject) || neighbourObject.IsOnRight(_placedObject)) + { + isConnected &= neighbourObject.Direction != TileHelper.GetOpposite(_placedObject.Direction); + } + + isConnected &= neighbourObject.GenericType == _genericType; + isConnected &= neighbourObject.SpecificType == _specificType; + + return isConnected; + } + + + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + { + Setup(); + + bool changed = false; + for (int i = 0; i < neighbourObjects.Length; i++) + { + changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); + } + + if (changed) + { + UpdateMeshAndDirection(); + } + } + + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + { + Setup(); + + bool isConnected = IsConnected(dir, neighbourObject); + + bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + + if (isUpdated) + { + UpdateMeshAndDirection(); + } + + return isUpdated; + } + + protected void UpdateMeshAndDirection() + { + + Tuple info; + + var tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + + var neighbours = map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); + + + List neighboursFacingDirection = new(); + + // TODO not solid code if order of neighbours gets changed + foreach (Direction dir in TileHelper.CardinalDirections()) + { + if(_adjacencyMap.HasConnection(dir)) + { + neighboursFacingDirection.Add(neighbours[(int)dir].Direction); + } + } + + info = AdjacencyResolver.GetMeshAndDirectionAndRotation(_adjacencyMap, PlacedObjectDirection, neighboursFacingDirection); + + _placedObject.SetDirection(info.Item1); + + if (_filter == null) + { + Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + } + + _filter.mesh = info.Item2.Mesh; + + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, info.Item2.Rotation, eulerRotation.z); + + transform.localRotation = localRotation; + } + } +} + diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs.meta new file mode 100644 index 0000000000..0fdf60c325 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 479fbe67c0de04b449f924bc5462ede3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 5351fca1fd96bcd1b2067cda88397c507141ae54 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 17 Oct 2023 15:33:20 +0200 Subject: [PATCH 27/87] no more than 2 connections for couches --- .../Tile/Connections/DirectionnalAdjacencyConnector.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 9240537df6..0bc4036ea5 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -79,6 +79,8 @@ public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) if (!TileHelper.CardinalDirections().Contains(dir)) return false; + if (_adjacencyMap.CardinalConnectionCount == 2) return false; + // add a check to see if connected to another neighbour object instead of the cardinal connection count. bool isConnected = true; @@ -177,5 +179,7 @@ protected void UpdateMeshAndDirection() transform.localRotation = localRotation; } } + + } From 4982156556cba28e6a89cc5841d1614c878b73b6 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 17 Oct 2023 15:33:39 +0200 Subject: [PATCH 28/87] simplify Lin Lout rotation computation --- .../DirectionnalShapeResolver.cs | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs index bc57d737cb..ad2416162e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs @@ -59,11 +59,11 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace break; case AdjacencyShape.LIn: mesh = lIn; - rotation = LInRotation(adjacencyMap); + rotation = LOutLinRotation(adjacencyMap); break; case AdjacencyShape.LOut: mesh = lOut; - rotation = LOutRotation(adjacencyMap); + rotation = LOutLinRotation(adjacencyMap); break; default: Debug.LogError($"Received unexpected shape from simple shape resolver: {shape}"); @@ -91,6 +91,7 @@ public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction //When two connections, checks if they're opposite or adjacent case 2: + // TODO : should not connect in I if two sofas are facing away, except if those two sofas are taking LIN or LOut shape. if (adjacencyMap.HasConnection(Direction.North) == adjacencyMap.HasConnection(Direction.South)) return AdjacencyShape.I; @@ -137,7 +138,11 @@ private static bool IsInsideConfiguration(AdjacencyMap adjacencyMap, Direction d } } - private static float LOutRotation(AdjacencyMap connections) + /// + /// Simply find the 0 rotation of the LOut and LIn models, and depending on the adjacencies position of connected stuff, + /// rotate accordingly. + /// + private static float LOutLinRotation(AdjacencyMap connections) { var adjacencies = connections.GetAdjacencies(true); if(adjacencies.Contains(Direction.South) && adjacencies.Contains(Direction.East)) @@ -157,26 +162,5 @@ private static float LOutRotation(AdjacencyMap connections) return 0f; } - - private static float LInRotation(AdjacencyMap connections) - { - var adjacencies = connections.GetAdjacencies(true); - if (adjacencies.Contains(Direction.South) && adjacencies.Contains(Direction.East)) - { - return 90f; - } - - if (adjacencies.Contains(Direction.South) && adjacencies.Contains(Direction.West)) - { - return 180f; - } - - if (adjacencies.Contains(Direction.North) && adjacencies.Contains(Direction.West)) - { - return 270f; - } - - return 0f; - } } } From 686e0f08f0aaadeb058d4dcbb51646e6f5c1db1c Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 17 Oct 2023 23:27:42 +0200 Subject: [PATCH 29/87] add some more helpers --- .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index bac5d6d31d..ac77854dde 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -5,6 +5,7 @@ using System.Runtime.CompilerServices; using UnityEngine; using SS3D.Utils; +using Coimbra; namespace SS3D.Systems.Tile { @@ -58,10 +59,31 @@ public static TileLayer[] GetTileLayers() return TileLayers; } - public static Tuple GetAdjacentDirections(Direction dir) + /// + /// Return the closest cardinal directions from a given other direction. + /// + /// + /// + public static List ClosestCardinalAdjacentTo(Direction dir) + { + if(CardinalDirections().Contains(dir)) return new List { dir }; + return GetAdjacentDirections(dir); + } + + public static List GetAdjacentDirections(Direction dir) + { + return new List{ (Direction)MathUtility.mod((int)dir + 1, 8), + (Direction)MathUtility.mod((int)dir - 1, 8) }; + } + + /// + /// Return the three adjacent directions to Direction dir including itself. + /// + public static List GetAdjacentAndMiddleDirection(Direction dir) { - return new Tuple( (Direction) MathUtility.mod((int) dir + 1, 8), - (Direction)MathUtility.mod((int)dir - 1, 8) ); + var list = new List { dir }; + list.AddRange(GetAdjacentDirections(dir)); + return list; } /// From 7f293b2bb94f851dd41b5d88b99a284058ce2a2c Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 17 Oct 2023 23:28:24 +0200 Subject: [PATCH 30/87] add list extension --- Assets/Scripts/SS3D/Utils/ListExtensions.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Assets/Scripts/SS3D/Utils/ListExtensions.cs b/Assets/Scripts/SS3D/Utils/ListExtensions.cs index cd0816229f..f520348e37 100644 --- a/Assets/Scripts/SS3D/Utils/ListExtensions.cs +++ b/Assets/Scripts/SS3D/Utils/ListExtensions.cs @@ -1,5 +1,7 @@ using JetBrains.Annotations; using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; namespace SS3D.Utils { @@ -14,5 +16,14 @@ public static bool OneElementOnly([NotNull] this List list) { return list.Count == 1; } + + /// + /// Checks if the content of the list contains any element from another list. Slow for large lists. + /// Be aware it's based upon the Equals method to compare equality. + /// + public static bool ContainsAny([NotNull] this List list, List otherList) + { + return list.Any(x => otherList.Any(y => y.Equals(x))); + } } } \ No newline at end of file From 879674daf005565836e6452222c6022b2be53ee3 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 17 Oct 2023 23:28:43 +0200 Subject: [PATCH 31/87] solve some direction resolving for directionnals --- .../DirectionnalShapeResolver.cs | 90 +++++++++++++++---- 1 file changed, 74 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs index ad2416162e..e395f0627c 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs @@ -1,7 +1,9 @@ using Coimbra; +using SS3D.Utils; using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace SS3D.Systems.Tile.Connections.AdjacencyTypes @@ -26,8 +28,8 @@ public struct DirectionnalShapeResolver /// /// /// - /// - /// + /// The connection with this directionnal. + /// this Directionnal direction, toward what it looks. /// Neigthbours direction are only cardinal neighbours /// public Tuple GetMeshAndDirectionAndRotation(AdjacencyMap adjacencyMap, Direction direction, List neighboursDirection) @@ -38,7 +40,10 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace AdjacencyShape shape = GetSimpleShape(adjacencyMap, direction, neighboursDirection); - + // TODO : should set LIN and LOut shape toward the middle direction between their two connections, such that they are always + // in a diagonal direction. + // TODO : All other shape should have their direction reset to an appropriate value. That is necessary for a shape going from + // LIN LOut to a simple one connection shape. switch (shape) { case AdjacencyShape.O: @@ -47,10 +52,18 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace break; case AdjacencyShape.ULeft: mesh = uLeft; + var closestsOfNeighbour = TileHelper.ClosestCardinalAdjacentTo(neighboursDirection[0]); + var closestsOfThis = TileHelper.ClosestCardinalAdjacentTo(direction); + var closest = closestsOfNeighbour.Intersect(closestsOfThis); + direction = closest.FirstOrDefault(); rotation = TileHelper.AngleBetween(Direction.North, direction); break; case AdjacencyShape.URight: mesh = uRight; + closestsOfNeighbour = TileHelper.ClosestCardinalAdjacentTo(neighboursDirection[0]); + closestsOfThis = TileHelper.ClosestCardinalAdjacentTo(direction); + closest = closestsOfNeighbour.Intersect(closestsOfThis); + direction = closest.FirstOrDefault(); rotation = TileHelper.AngleBetween(Direction.North, direction); break; case AdjacencyShape.I: @@ -59,11 +72,14 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace break; case AdjacencyShape.LIn: mesh = lIn; + // TODO : neighbours can also be LIn or LOut so their directions can be diagonal as well. rotation = LOutLinRotation(adjacencyMap); + direction = LInLOutDirection(neighboursDirection[0], neighboursDirection[1]); break; case AdjacencyShape.LOut: mesh = lOut; rotation = LOutLinRotation(adjacencyMap); + direction = LInLOutDirection(neighboursDirection[0], neighboursDirection[1]); break; default: Debug.LogError($"Received unexpected shape from simple shape resolver: {shape}"); @@ -82,18 +98,27 @@ public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction case 0: return AdjacencyShape.O; case 1: + // TODO should check if the single neighbour connection is adjacent, not only the same. + // currently prevents correct U connection with LIn LOut shapes. var directionConnection = adjacencyMap.GetSingleConnection(true); - var relative =TileHelper.GetRelativeDirection(dir, directionConnection); - if(!NeighboursDirection.Contains(dir)) return AdjacencyShape.O; + var relative = TileHelper.GetRelativeDirection(dir, directionConnection); + if(!TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(NeighboursDirection[0])) + return AdjacencyShape.O; if (relative == Direction.East) return AdjacencyShape.ULeft; else return AdjacencyShape.URight; //When two connections, checks if they're opposite or adjacent case 2: - // TODO : should not connect in I if two sofas are facing away, except if those two sofas are taking LIN or LOut shape. - if (adjacencyMap.HasConnection(Direction.North) == adjacencyMap.HasConnection(Direction.South)) - return AdjacencyShape.I; + if (adjacencyMap.HasConnection(Direction.North) == adjacencyMap.HasConnection(Direction.South)) + { + // To get a I, neighbours directionnal need to be oriented the same way as this directionnal, or + // in an adjacent direction (basically if they take a LIn or LOut shape) + if (TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(NeighboursDirection[0]) && + TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(NeighboursDirection[1])) + return AdjacencyShape.I; + else return AdjacencyShape.O; + } if (IsInsideConfiguration(adjacencyMap, dir)) return AdjacencyShape.LIn; @@ -122,17 +147,21 @@ private static bool IsInsideConfiguration(AdjacencyMap adjacencyMap, Direction d switch (dir) { case Direction.North: - return adjacencies.Contains(Direction.North) && - (adjacencies.Contains(Direction.East) || adjacencies.Contains(Direction.West)); + return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.North)) && + ( adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.East)) || + adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.West))); case Direction.East: - return adjacencies.Contains(Direction.East) && - (adjacencies.Contains(Direction.North) || adjacencies.Contains(Direction.South)); + return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.East)) && + (adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.North)) || + adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.South))); case Direction.South: - return adjacencies.Contains(Direction.South) && - (adjacencies.Contains(Direction.East) || adjacencies.Contains(Direction.West)); + return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.South)) && + (adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.East)) || + adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.West))); case Direction.West: - return adjacencies.Contains(Direction.West) && - (adjacencies.Contains(Direction.South) || adjacencies.Contains(Direction.North)); + return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.West)) && + (adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.South)) || + adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.North))); default: return false; } @@ -162,5 +191,34 @@ private static float LOutLinRotation(AdjacencyMap connections) return 0f; } + + private static Direction LInLOutDirection(Direction firstNeighbour, Direction secondNeighbour) + { + if((TileHelper.GetAdjacentAndMiddleDirection(Direction.East).Contains(firstNeighbour) + && TileHelper.GetAdjacentAndMiddleDirection(Direction.North).Contains(secondNeighbour)) || + (TileHelper.GetAdjacentAndMiddleDirection(Direction.East).Contains(secondNeighbour) + && TileHelper.GetAdjacentAndMiddleDirection(Direction.North).Contains(firstNeighbour))) + { + return Direction.NorthEast; + } + else if ((TileHelper.GetAdjacentAndMiddleDirection(Direction.East).Contains(firstNeighbour) + && TileHelper.GetAdjacentAndMiddleDirection(Direction.South).Contains(secondNeighbour)) || + (TileHelper.GetAdjacentAndMiddleDirection(Direction.East).Contains(secondNeighbour) + && TileHelper.GetAdjacentAndMiddleDirection(Direction.South).Contains(firstNeighbour))) + { + return Direction.SouthEast; + } + else if ((TileHelper.GetAdjacentAndMiddleDirection(Direction.West).Contains(firstNeighbour) + && TileHelper.GetAdjacentAndMiddleDirection(Direction.South).Contains(secondNeighbour)) || + (TileHelper.GetAdjacentAndMiddleDirection(Direction.West).Contains(secondNeighbour) + && TileHelper.GetAdjacentAndMiddleDirection(Direction.South).Contains(firstNeighbour))) + { + return Direction.SouthWest; + } + else + { + return Direction.NorthWest; + } + } } } From 2ce4a89b58e410830f2f85617a297d65198e2fa7 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 19 Oct 2023 13:51:53 +0200 Subject: [PATCH 32/87] add atdirectionof method --- .../Tile/PlacedObjects/PlacedTileObject.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 9a05ee2732..61cfc312bd 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -185,5 +185,26 @@ public bool IsOnLeft(PlacedTileObject other) return false; } + + /// + /// TODO don't use chunk if possible, or chunk coordinate as well. + /// Is this at the direction of the other object ? (has to be adjacent). + /// + public bool AtDirectionOf(PlacedTileObject other, Direction dir) + { + switch (dir) + { + case Direction.North: + return math.mod(other.Origin.y - 1, TileConstants.ChunkSize) == Origin.y; + case Direction.South: + return math.mod(other.Origin.y + 1, TileConstants.ChunkSize) == Origin.y; + case Direction.East: + return math.mod(other.Origin.x - 1, TileConstants.ChunkSize) == Origin.x; + case Direction.West: + return math.mod(other.Origin.x + 1, TileConstants.ChunkSize) == Origin.x; + default: return false; + } + + } } } \ No newline at end of file From 848c128b69f7b0498f472508d36987fbdc700cd8 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 19 Oct 2023 13:52:16 +0200 Subject: [PATCH 33/87] use neighbour instead of neighbour directions --- .../DirectionnalShapeResolver.cs | 65 +++++++------------ 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs index e395f0627c..680f964eeb 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs @@ -32,13 +32,14 @@ public struct DirectionnalShapeResolver /// this Directionnal direction, toward what it looks. /// Neigthbours direction are only cardinal neighbours /// - public Tuple GetMeshAndDirectionAndRotation(AdjacencyMap adjacencyMap, Direction direction, List neighboursDirection) + public Tuple GetMeshAndDirectionAndRotation(AdjacencyMap adjacencyMap, Direction direction, + List neighbours, PlacedTileObject actual) { // Determine rotation and mesh specially for every single case. float rotation = 0.0f; Mesh mesh; - AdjacencyShape shape = GetSimpleShape(adjacencyMap, direction, neighboursDirection); + AdjacencyShape shape = GetSimpleShape(adjacencyMap, direction, neighbours, actual); // TODO : should set LIN and LOut shape toward the middle direction between their two connections, such that they are always // in a diagonal direction. @@ -52,7 +53,7 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace break; case AdjacencyShape.ULeft: mesh = uLeft; - var closestsOfNeighbour = TileHelper.ClosestCardinalAdjacentTo(neighboursDirection[0]); + var closestsOfNeighbour = TileHelper.ClosestCardinalAdjacentTo(neighbours[0].Direction); var closestsOfThis = TileHelper.ClosestCardinalAdjacentTo(direction); var closest = closestsOfNeighbour.Intersect(closestsOfThis); direction = closest.FirstOrDefault(); @@ -60,7 +61,7 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace break; case AdjacencyShape.URight: mesh = uRight; - closestsOfNeighbour = TileHelper.ClosestCardinalAdjacentTo(neighboursDirection[0]); + closestsOfNeighbour = TileHelper.ClosestCardinalAdjacentTo(neighbours[0].Direction); closestsOfThis = TileHelper.ClosestCardinalAdjacentTo(direction); closest = closestsOfNeighbour.Intersect(closestsOfThis); direction = closest.FirstOrDefault(); @@ -74,12 +75,12 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace mesh = lIn; // TODO : neighbours can also be LIn or LOut so their directions can be diagonal as well. rotation = LOutLinRotation(adjacencyMap); - direction = LInLOutDirection(neighboursDirection[0], neighboursDirection[1]); + direction = LInLOutDirection(neighbours[0].Direction, neighbours[1].Direction); break; case AdjacencyShape.LOut: mesh = lOut; rotation = LOutLinRotation(adjacencyMap); - direction = LInLOutDirection(neighboursDirection[0], neighboursDirection[1]); + direction = LInLOutDirection(neighbours[0].Direction, neighbours[1].Direction); break; default: Debug.LogError($"Received unexpected shape from simple shape resolver: {shape}"); @@ -90,7 +91,7 @@ public Tuple GetMeshAndDirectionAndRotation(Adjace return new Tuple (direction, new MeshDirectionInfo { Mesh = mesh, Rotation = rotation }); } - public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction dir, List NeighboursDirection) + public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction dir, List neighbours, PlacedTileObject actual) { int cardinalConnectionCount = adjacencyMap.CardinalConnectionCount; switch (cardinalConnectionCount) @@ -98,11 +99,10 @@ public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction case 0: return AdjacencyShape.O; case 1: - // TODO should check if the single neighbour connection is adjacent, not only the same. - // currently prevents correct U connection with LIn LOut shapes. var directionConnection = adjacencyMap.GetSingleConnection(true); var relative = TileHelper.GetRelativeDirection(dir, directionConnection); - if(!TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(NeighboursDirection[0])) + // check if the neighbour is oriented in the same direction or in a diagonal adjacent one. + if(!TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(neighbours[0].Direction)) return AdjacencyShape.O; if (relative == Direction.East) return AdjacencyShape.ULeft; @@ -114,13 +114,14 @@ public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction { // To get a I, neighbours directionnal need to be oriented the same way as this directionnal, or // in an adjacent direction (basically if they take a LIn or LOut shape) - if (TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(NeighboursDirection[0]) && - TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(NeighboursDirection[1])) + if (TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(neighbours[0].Direction) && + TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(neighbours[1].Direction)) return AdjacencyShape.I; + // TODO add cases for ULeft and URight else return AdjacencyShape.O; - } + } - if (IsInsideConfiguration(adjacencyMap, dir)) + if (IsInsideConfiguration(neighbours, adjacencyMap, dir, actual)) return AdjacencyShape.LIn; else return AdjacencyShape.LOut; @@ -132,39 +133,21 @@ public static AdjacencyShape GetSimpleShape(AdjacencyMap adjacencyMap, Direction } /// - /// It's useful to draw the 8 different configuration of LIn shape - /// with 3 couch, one in the middle and two other in cardinal positions. Consider the middle couch can point towards any cardinal - /// direction. We don't care about the directions of the two other couches, what matters is their position relative to the middle one. - /// This help understand the code below. /// /// /// /// - private static bool IsInsideConfiguration(AdjacencyMap adjacencyMap, Direction dir) + private static bool IsInsideConfiguration(List neighbours, AdjacencyMap adjacencyMap, Direction dir, PlacedTileObject actual) { - var adjacencies = adjacencyMap.GetAdjacencies(true); + var adjacencies = adjacencyMap.GetAdjacencies(true); - switch (dir) - { - case Direction.North: - return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.North)) && - ( adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.East)) || - adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.West))); - case Direction.East: - return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.East)) && - (adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.North)) || - adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.South))); - case Direction.South: - return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.South)) && - (adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.East)) || - adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.West))); - case Direction.West: - return adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.West)) && - (adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.South)) || - adjacencies.ContainsAny(TileHelper.GetAdjacentAndMiddleDirection(Direction.North))); - default: - return false; - } + var neighbourWithDifferentOrientation = neighbours.Find(x => x.Direction != dir); + + Direction different = neighbourWithDifferentOrientation.Direction; + + var otherneighbour = neighbours.Find(x => x != neighbourWithDifferentOrientation); + + return TileHelper.GetAdjacentAndMiddleDirection(dir).Contains(otherneighbour.Direction) && actual.AtDirectionOf(otherneighbour, different); } /// From fe700c0bfd35501a5ec6d25fea8c892689d3145c Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 19 Oct 2023 13:52:26 +0200 Subject: [PATCH 34/87] same --- .../Connections/DirectionnalAdjacencyConnector.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 0bc4036ea5..02cd4fe92f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -77,8 +77,13 @@ public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) { if (neighbourObject == null) return false; + // don't connect on an already connected neighbour with two connections. + if(TileHelper.DiagonalDirections().Contains(neighbourObject.Direction)) return false; + + // don't connect on neighbours not in cardinal positions. if (!TileHelper.CardinalDirections().Contains(dir)) return false; + // don't connect to anything new if already two connections. if (_adjacencyMap.CardinalConnectionCount == 2) return false; // add a check to see if connected to another neighbour object instead of the cardinal connection count. @@ -150,18 +155,18 @@ protected void UpdateMeshAndDirection() var neighbours = map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); - List neighboursFacingDirection = new(); + List neighboursFacingDirection = new(); // TODO not solid code if order of neighbours gets changed foreach (Direction dir in TileHelper.CardinalDirections()) { if(_adjacencyMap.HasConnection(dir)) { - neighboursFacingDirection.Add(neighbours[(int)dir].Direction); + neighboursFacingDirection.Add(neighbours[(int)dir]); } } - info = AdjacencyResolver.GetMeshAndDirectionAndRotation(_adjacencyMap, PlacedObjectDirection, neighboursFacingDirection); + info = AdjacencyResolver.GetMeshAndDirectionAndRotation(_adjacencyMap, PlacedObjectDirection, neighboursFacingDirection, _placedObject); _placedObject.SetDirection(info.Item1); From b65681a75f4265a8484ea48a4b7f3307ae0a1589 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 21 Oct 2023 00:56:09 +0200 Subject: [PATCH 35/87] paradigm changes --- Assets/Content/Scenes/Directionnals.unity | 1543 +++++++++++++++++ .../Content/Scenes/Directionnals.unity.meta | 7 + .../DirectionnalAdjacencyConnector.cs | 334 +++- .../Tile/Connections/IAdjacencyConnector.cs | 2 + .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 5 + Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 15 + 6 files changed, 1846 insertions(+), 60 deletions(-) create mode 100644 Assets/Content/Scenes/Directionnals.unity create mode 100644 Assets/Content/Scenes/Directionnals.unity.meta diff --git a/Assets/Content/Scenes/Directionnals.unity b/Assets/Content/Scenes/Directionnals.unity new file mode 100644 index 0000000000..477fba447f --- /dev/null +++ b/Assets/Content/Scenes/Directionnals.unity @@ -0,0 +1,1543 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &42056749 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 19 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 2.64 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 0.62 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 180 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -819412828331094011, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447837209868186 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothLOut + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &491865392 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 6.81 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 0.693 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447836290165894 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothI (001) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &521142152 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 8.2 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: -1.16 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 0.69 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447836961758221 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothI (003) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1 &626664182 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 626664186} + - component: {fileID: 626664185} + - component: {fileID: 626664184} + - component: {fileID: 626664183} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!64 &626664183 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626664182} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &626664184 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626664182} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 5003e6577566f0748b94899aefcc5569, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &626664185 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626664182} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &626664186 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626664182} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 2.76, y: -3.1864147, z: 0.5094048} + m_LocalScale: {x: 20, y: 1, z: 20} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &641699770 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 18 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: -2.07 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: -1.44 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8550456321050019914, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447839752735039 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothLIn + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1 &670822652 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 670822654} + - component: {fileID: 670822653} + m_Layer: 0 + m_Name: Spot Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &670822653 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 670822652} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 0 + m_Shape: 0 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1.2 + m_Range: 93.09 + m_SpotAngle: 171.9 + m_InnerSpotAngle: 1 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &670822654 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 670822652} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 5.4012976, y: 14.56, z: 4.61} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!1001 &864419407 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 5.51 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 0.04 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 270 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447837454256304 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothI (002) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &879879352 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 6.83 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: -0.89 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 180 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447838454335179 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothI + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &956478594 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 4.34 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 1.57 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447838961165924 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothULeft + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1096799253 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 2.62 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: -0.46 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447837133897690 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothURight (002) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1215829029 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 12 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 9.35 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 3.06 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447837878113859 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothULeft (002) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1216959828 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 3.52 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 1.66 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447837167626351 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothO (002) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1257945242 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 15 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: -1.38 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 1.64 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447838841410258 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothURight (001) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1356587983 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: -2.699 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 1.73 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 270 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447836705729513 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothURight (003) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1424145921 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 0.71 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: -0.37 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447839528395361 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothO (003) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1473862616 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 8.35 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0.12 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 3.98 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447838969076313 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothULeft (001) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1608970672 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 1.54 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0.16 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 0.59 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447838630502840 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothO (001) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &1686739664 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: -1.81 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 0.68 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447836182566665 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothO + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &2000198059 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 13 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: 8.311001 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 2.151 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 180 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447839042639380 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothULeft (003) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} +--- !u!1001 &2020792561 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_RootOrder + value: 14 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.x + value: -1.59 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalPosition.z + value: 2.77 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.w + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 270 + objectReference: {fileID: 0} + - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: _scenePathHash + value: 3726325891 + objectReference: {fileID: 0} + - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: k__BackingField + value: 16004447838707847314 + objectReference: {fileID: 0} + - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} + propertyPath: m_Name + value: DinnerBoothURight + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} diff --git a/Assets/Content/Scenes/Directionnals.unity.meta b/Assets/Content/Scenes/Directionnals.unity.meta new file mode 100644 index 0000000000..41d3efc946 --- /dev/null +++ b/Assets/Content/Scenes/Directionnals.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 718efdf7a5aa6c844b3096b9b7486c5f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 02cd4fe92f..62ffdac937 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -8,7 +8,9 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; +using UnityEngine.PlayerLoop; namespace SS3D.Systems.Tile.Connections { @@ -68,120 +70,332 @@ private void Setup() } /// - /// directionnal are connected only with other directionnals on their right or on their left. + /// implement /// - /// - /// - /// public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) { - if (neighbourObject == null) return false; + return true; + } - // don't connect on an already connected neighbour with two connections. - if(TileHelper.DiagonalDirections().Contains(neighbourObject.Direction)) return false; + // ignore param + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + { + UpdateAllAndNeighbours(true); + } - // don't connect on neighbours not in cardinal positions. - if (!TileHelper.CardinalDirections().Contains(dir)) return false; + - // don't connect to anything new if already two connections. - if (_adjacencyMap.CardinalConnectionCount == 2) return false; + // ignore param + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + { + UpdateAllAndNeighbours(true); + return true; + } - // add a check to see if connected to another neighbour object instead of the cardinal connection count. + private void UpdateAllAndNeighbours(bool updateNeighbours) + { + Setup(); + var neighbours = GetNeighbourDirectionnal(); - bool isConnected = true; + Tuple results; - if (neighbourObject.IsInFront(_placedObject) || neighbourObject.IsBehind(_placedObject)) + if (HasSingleConnection(neighbours, out PlacedTileObject neighbour)) { - isConnected &= neighbourObject.Direction != _placedObject.Direction && - neighbourObject.Direction != TileHelper.GetOpposite(_placedObject.Direction); + if (neighbour.IsOnRight(_placedObject)) + results = UpdateMeshDirectionSingleConnection(true, neighbour); + else + results = UpdateMeshDirectionSingleConnection(false, neighbour); } - if (neighbourObject.IsOnLeft(_placedObject) || neighbourObject.IsOnRight(_placedObject)) + else if (HasDoubleConnection(neighbours, out PlacedTileObject first, out PlacedTileObject second, true)) { - isConnected &= neighbourObject.Direction != TileHelper.GetOpposite(_placedObject.Direction); + results = UpdateMeshDirectionDoubleConnection(first, second); } - isConnected &= neighbourObject.GenericType == _genericType; - isConnected &= neighbourObject.SpecificType == _specificType; + // no connections then + else + { + results = new Tuple(AdjacencyResolver.o, + TileHelper.AngleBetween(Direction.North, _placedObject.Direction), _placedObject.Direction); + } - return isConnected; - } + _placedObject.SetDirection(results.Item3); + _filter.mesh = results.Item1; + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, results.Item2, eulerRotation.z); + transform.localRotation = localRotation; - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + if (updateNeighbours) + { + foreach(var adjacent in neighbours) + { + adjacent.GetComponent().UpdateAllAndNeighbours(false); + } + } + } + + private bool HasSingleConnection(List neighbours ,out PlacedTileObject neighbour) { - Setup(); + neighbour = null; + // has double connection, therefore not a single one. + if(HasDoubleConnection(neighbours, out var firstNeighbour, out var secondNeighbour, true)) + { + return false; + } - bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) + // neighbour is on right or left and in the same direction, it's a connection (Ushape) + foreach (var placed in neighbours) { - changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); + if (placed.IsOnLeft(_placedObject) && placed.Direction == _placedObject.Direction || + placed.IsOnRight(_placedObject) && placed.Direction == _placedObject.Direction) + { + neighbour = placed; + return true; + } } - if (changed) + // neighbour is on right or left and has a double connection with one connection with this object + // seems like it works ! + foreach (var placed in neighbours) { - UpdateMeshAndDirection(); + if (placed.IsOnLeft(_placedObject) || placed.IsOnRight(_placedObject)) + { + var neighbourNeighbours = placed.GetComponent().GetNeighbourDirectionnal(); + var neighbourConnector = placed.GetComponent(); + if (neighbourConnector.HasDoubleConnection(neighbourNeighbours, out var first, out var second, true)) + { + if(first == _placedObject || second == _placedObject) + { + neighbour = placed; + return true; + } + } + } } + + return false; } - public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) + private bool HasDoubleConnection(List neighbours, + out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour, bool checkForIShape) { - Setup(); + firstNeighbour = null; + secondNeighbour = null; - bool isConnected = IsConnected(dir, neighbourObject); + // check for I shape, if has a neighbour on both left and right. + foreach (var neighbour in neighbours) + { + if (neighbour.IsOnLeft(_placedObject)) + { + secondNeighbour = neighbour; + } + if (neighbour.IsOnRight(_placedObject)) + { + firstNeighbour = neighbour; + } + } - bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + // two connections there, for an I shape. + // todo I shape should not be only when neighbours are same directions. + if (firstNeighbour != null && secondNeighbour != null) + { + if (firstNeighbour.Direction == _placedObject.Direction && secondNeighbour.Direction == _placedObject.Direction) return true; + } - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + // checks for the UIN and UOut shape. + firstNeighbour = null; + secondNeighbour = null; - if (isUpdated) + // check if neighbour on left facing the same direction. + foreach (var neighbour in neighbours) { - UpdateMeshAndDirection(); + if (neighbour.IsOnLeft(_placedObject) && neighbour.Direction == _placedObject.Direction) + { + secondNeighbour = neighbour; + } + } + + // check if neighbour on right as well facing the same direction, or only on right + foreach (var neighbour in neighbours) + { + if (neighbour.IsOnRight(_placedObject) && neighbour.Direction == _placedObject.Direction) + { + if (secondNeighbour == null) + { + secondNeighbour = neighbour; + } + else + { + firstNeighbour = neighbour; + } + } + } + + if (secondNeighbour != null && secondNeighbour.IsOnLeft(_placedObject)) + { + foreach (var neighbour in neighbours) + { + // two connections for a LIN + if (neighbour.IsInFront(_placedObject) && + neighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction)) + { + firstNeighbour = neighbour; + return true; + } + + // two connections for a LOut + if (neighbour.IsBehind(_placedObject) && + neighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction)) + { + firstNeighbour = neighbour; + return true; + } + } } - return isUpdated; + if (secondNeighbour != null && secondNeighbour.IsOnRight(_placedObject)) + { + foreach (var neighbour in neighbours) + { + // two connections for a LIN + if (neighbour.IsInFront(_placedObject) && + neighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction)) + { + firstNeighbour = neighbour; + return true; + } + + // two connections for a LOut + if (neighbour.IsBehind(_placedObject) && + neighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction)) + { + firstNeighbour = neighbour; + return true; + } + } + } + + return false; } - protected void UpdateMeshAndDirection() - { - Tuple info; + private List GetNeighbourDirectionnal() + { var tileSystem = Subsystems.Get(); var map = tileSystem.CurrentMap; - - var neighbours = map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); + // todo only keep those on cardinal. + var neighbours = map.GetCardinalNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); + return neighbours.Where(x => x != null && + x.TryGetComponent(out var component)).ToList(); + } + + private Tuple UpdateMeshDirectionSingleConnection(bool neighbourOnRight, PlacedTileObject neighbourObject) + { + float rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); + // should it take neighbour direction or its own ? Or that depends ? + if (neighbourOnRight) + { + return new Tuple(AdjacencyResolver.uRight, rotation, _placedObject.Direction); + } + else + { + return new Tuple(AdjacencyResolver.uLeft, rotation, _placedObject.Direction); + } + } - List neighboursFacingDirection = new(); + /// + /// In case a neighbour is in front or behind of this placed object, it should be the first neighbour parameter. + /// no object should be null. + /// + private Tuple UpdateMeshDirectionDoubleConnection(PlacedTileObject firstNeighbour, PlacedTileObject secondNeighbour) + { + // Cases for Lin + // this looks toward north, object in front looks toward east and object on the right side looks toward north. + float rotation; + Direction direction; + + // first Lin + if (firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction) && firstNeighbour.IsInFront(_placedObject) + && secondNeighbour.IsOnRight(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) + { + rotation = TileHelper.AngleBetween(Direction.North, secondNeighbour.Direction); + // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + direction = _placedObject.Direction; + return new Tuple(AdjacencyResolver.lIn, rotation, direction); + } - // TODO not solid code if order of neighbours gets changed - foreach (Direction dir in TileHelper.CardinalDirections()) + //second Lin + if (firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction) && firstNeighbour.IsInFront(_placedObject) + && secondNeighbour.IsOnLeft(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) { - if(_adjacencyMap.HasConnection(dir)) - { - neighboursFacingDirection.Add(neighbours[(int)dir]); - } + // if the second neighbour is on left (the one facing the same direction), then the other + // other side of the Lin couch should be linked to it, so we need to do a -90 degree rotation compared to neighbour on right. + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousCardinalDir(secondNeighbour.Direction)); + // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + direction = _placedObject.Direction; + return new Tuple(AdjacencyResolver.lIn, rotation, direction); } - info = AdjacencyResolver.GetMeshAndDirectionAndRotation(_adjacencyMap, PlacedObjectDirection, neighboursFacingDirection, _placedObject); + // first LOut + // This looks toward north, behind looks toward west, and on the right looks toward north + if (firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction) && firstNeighbour.IsBehind(_placedObject) + && secondNeighbour.IsOnRight(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) + { + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetNextCardinalDir(secondNeighbour.Direction)); + // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + direction = _placedObject.Direction; + return new Tuple(AdjacencyResolver.lOut, rotation, direction); + } - _placedObject.SetDirection(info.Item1); + // second LOut + // This looks toward north, behind looks toward east, and on the left looks toward north + if (firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction) && firstNeighbour.IsBehind(_placedObject) + && secondNeighbour.IsOnLeft(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) + { + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetOpposite(secondNeighbour.Direction)); + // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + direction = _placedObject.Direction; + return new Tuple(AdjacencyResolver.lOut, rotation, direction); + } - if (_filter == null) + // I case + if(_placedObject.Direction == firstNeighbour.Direction && _placedObject.Direction == secondNeighbour.Direction) { - Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info); + rotation = TileHelper.AngleBetween(Direction.North, secondNeighbour.Direction); + direction = firstNeighbour.Direction; + return new Tuple(AdjacencyResolver.i, rotation, direction); } - _filter.mesh = info.Item2.Mesh; + var firstConnector = firstNeighbour.GetComponent(); + var secondConnector = secondNeighbour.GetComponent(); + + var neighboursOfFirst = firstConnector.GetNeighbourDirectionnal().Where(x => x != _placedObject).ToList(); + var neighboursOfSecond = secondConnector.GetNeighbourDirectionnal().Where(x => x != _placedObject).ToList() ; + + // second I Case, neighbours are facing cardinal directions from this, but they are connected to another one. + if ( + (_placedObject.Direction == firstNeighbour.Direction + || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) && + firstConnector.HasSingleConnection(neighboursOfFirst, out var n1))) + + && ((_placedObject.Direction == secondNeighbour.Direction) + || (secondNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) && + secondConnector.HasSingleConnection(neighboursOfSecond, out var n2))) + ) + { + rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); + // rotation = TileHelper.AngleBetween(Direction.North, secondNeighbour.Direction); + direction = _placedObject.Direction; + return new Tuple(AdjacencyResolver.i, rotation, direction); + } - Quaternion localRotation = transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, info.Item2.Rotation, eulerRotation.z); + Debug.LogError("should not reach this point"); - transform.localRotation = localRotation; + return new Tuple(AdjacencyResolver.o, 0f, Direction.North); } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs index 2e98df709e..c04f9c59f7 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs @@ -6,6 +6,8 @@ public interface IAdjacencyConnector { bool UpdateSingleConnection(Direction direction, PlacedTileObject neighbourObject, bool updateNeighbour); + + // TODO remove the neighbours object, should leave it to the conenctor to get them. void UpdateAllConnections(PlacedTileObject[] neighbourObjects); bool IsConnected(Direction dir, PlacedTileObject neighbourObject); } diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index ac77854dde..dc70c95e1f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -38,6 +38,11 @@ public static Direction GetNextCardinalDir(Direction dir) } } + public static Direction GetPreviousCardinalDir(Direction dir) + { + return (Direction) MathUtility.mod((int)dir - 2, 8); + } + /// /// Get the rotation angle of a particular dir. /// E.g. assuming north is the initial position (should be), north return 0, north-east 45 ... diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index c9a04da15b..7ebb64527f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -140,6 +140,21 @@ public PlacedTileObject[] GetNeighbourPlacedObjects(TileLayer layer, Vector3 wor return adjacentObjects; } + + public PlacedTileObject[] GetCardinalNeighbourPlacedObjects(TileLayer layer, Vector3 worldPosition) + { + PlacedTileObject[] adjacentObjects = new PlacedTileObject[8]; + + for (Direction direction = Direction.North; direction <= Direction.NorthWest; direction+= 2) + { + Tuple vector = TileHelper.ToCardinalVector(direction); + adjacentObjects[(int)direction] = GetTileObject(layer, worldPosition + new Vector3(vector.Item1, 0, vector.Item2)).PlacedObject; + } + + return adjacentObjects; + } + + /// /// Returns whether the specified object can be successfully build for a given position and direction. /// From 5f07e7caf34e8c0e3b5cf80d5ba7e10b56018202 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 21 Oct 2023 00:57:27 +0200 Subject: [PATCH 36/87] little comment --- .../Tile/Connections/DirectionnalAdjacencyConnector.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 62ffdac937..e51f32d4cd 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -14,6 +14,11 @@ namespace SS3D.Systems.Tile.Connections { + + /// + /// ISSUE : I connectors not connecting when one side isn't straight. + /// ISSUE : can't alternate between LIN LOUT diagonnally. + /// public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector { From 6596d63cd874f242b553519ac3bb12577e628067 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 24 Oct 2023 02:02:09 +0200 Subject: [PATCH 37/87] huge refactor --- .../DirectionnalAdjacencyConnector.cs | 438 ++++++++++-------- 1 file changed, 244 insertions(+), 194 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index e51f32d4cd..532f23989e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -11,6 +11,8 @@ using System.Linq; using UnityEngine; using UnityEngine.PlayerLoop; +using static UnityEngine.InputSystem.LowLevel.InputStateHistory; +using static UnityEngine.ParticleSystem; namespace SS3D.Systems.Tile.Connections { @@ -106,15 +108,12 @@ private void UpdateAllAndNeighbours(bool updateNeighbours) if (HasSingleConnection(neighbours, out PlacedTileObject neighbour)) { - if (neighbour.IsOnRight(_placedObject)) - results = UpdateMeshDirectionSingleConnection(true, neighbour); - else - results = UpdateMeshDirectionSingleConnection(false, neighbour); + results = UpdateMeshDirectionSingleConnection(neighbours); } - else if (HasDoubleConnection(neighbours, out PlacedTileObject first, out PlacedTileObject second, true)) + else if (HasDoubleConnection(neighbours, out PlacedTileObject first, out PlacedTileObject second)) { - results = UpdateMeshDirectionDoubleConnection(first, second); + results = UpdateMeshDirectionDoubleConnection(neighbours); } // no connections then @@ -144,145 +143,23 @@ private void UpdateAllAndNeighbours(bool updateNeighbours) private bool HasSingleConnection(List neighbours ,out PlacedTileObject neighbour) { neighbour = null; - // has double connection, therefore not a single one. - if(HasDoubleConnection(neighbours, out var firstNeighbour, out var secondNeighbour, true)) - { - return false; - } - - // neighbour is on right or left and in the same direction, it's a connection (Ushape) - foreach (var placed in neighbours) - { - if (placed.IsOnLeft(_placedObject) && placed.Direction == _placedObject.Direction || - placed.IsOnRight(_placedObject) && placed.Direction == _placedObject.Direction) - { - neighbour = placed; - return true; - } - } - // neighbour is on right or left and has a double connection with one connection with this object - // seems like it works ! - foreach (var placed in neighbours) - { - if (placed.IsOnLeft(_placedObject) || placed.IsOnRight(_placedObject)) - { - var neighbourNeighbours = placed.GetComponent().GetNeighbourDirectionnal(); - var neighbourConnector = placed.GetComponent(); - if (neighbourConnector.HasDoubleConnection(neighbourNeighbours, out var first, out var second, true)) - { - if(first == _placedObject || second == _placedObject) - { - neighbour = placed; - return true; - } - } - } - } + // has double connection, therefore not a single one. + if(HasDoubleConnection(neighbours, out var first, out var second)) return false; - return false; + return IsULeftBisConfiguration(neighbours, out var single) + || IsURightBisConfiguration(neighbours, out single) + || IsULeftConfiguration(neighbours, out single) + || IsURightConfiguration(neighbours, out single); } - private bool HasDoubleConnection(List neighbours, - out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour, bool checkForIShape) + private bool HasDoubleConnection(List neighbours, out PlacedTileObject first, out PlacedTileObject second) { - firstNeighbour = null; - secondNeighbour = null; - - // check for I shape, if has a neighbour on both left and right. - foreach (var neighbour in neighbours) - { - if (neighbour.IsOnLeft(_placedObject)) - { - secondNeighbour = neighbour; - } - if (neighbour.IsOnRight(_placedObject)) - { - firstNeighbour = neighbour; - } - } - - // two connections there, for an I shape. - // todo I shape should not be only when neighbours are same directions. - if (firstNeighbour != null && secondNeighbour != null) - { - if (firstNeighbour.Direction == _placedObject.Direction && secondNeighbour.Direction == _placedObject.Direction) return true; - } - - // checks for the UIN and UOut shape. - firstNeighbour = null; - secondNeighbour = null; - - // check if neighbour on left facing the same direction. - foreach (var neighbour in neighbours) - { - if (neighbour.IsOnLeft(_placedObject) && neighbour.Direction == _placedObject.Direction) - { - secondNeighbour = neighbour; - } - } - - // check if neighbour on right as well facing the same direction, or only on right - foreach (var neighbour in neighbours) - { - if (neighbour.IsOnRight(_placedObject) && neighbour.Direction == _placedObject.Direction) - { - if (secondNeighbour == null) - { - secondNeighbour = neighbour; - } - else - { - firstNeighbour = neighbour; - } - } - } - - if (secondNeighbour != null && secondNeighbour.IsOnLeft(_placedObject)) - { - foreach (var neighbour in neighbours) - { - // two connections for a LIN - if (neighbour.IsInFront(_placedObject) && - neighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction)) - { - firstNeighbour = neighbour; - return true; - } - - // two connections for a LOut - if (neighbour.IsBehind(_placedObject) && - neighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction)) - { - firstNeighbour = neighbour; - return true; - } - } - } - - if (secondNeighbour != null && secondNeighbour.IsOnRight(_placedObject)) - { - foreach (var neighbour in neighbours) - { - // two connections for a LIN - if (neighbour.IsInFront(_placedObject) && - neighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction)) - { - firstNeighbour = neighbour; - return true; - } - - // two connections for a LOut - if (neighbour.IsBehind(_placedObject) && - neighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction)) - { - firstNeighbour = neighbour; - return true; - } - } - } - - return false; + return IsFirstLInConfiguration(neighbours, out first, out second) + || IsSecondLInConfiguration(neighbours, out first, out second) + || IsFirstLOutConfiguration(neighbours, out first, out second) + || IsSecondLOutConfiguration(neighbours, out first, out second) + || IsIConfiguration(neighbours, out first, out second); } @@ -292,115 +169,288 @@ private List GetNeighbourDirectionnal() var tileSystem = Subsystems.Get(); var map = tileSystem.CurrentMap; - // todo only keep those on cardinal. var neighbours = map.GetCardinalNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); return neighbours.Where(x => x != null && x.TryGetComponent(out var component)).ToList(); } - private Tuple UpdateMeshDirectionSingleConnection(bool neighbourOnRight, PlacedTileObject neighbourObject) + private Tuple UpdateMeshDirectionSingleConnection(List neighbours) { float rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); - // should it take neighbour direction or its own ? Or that depends ? - if (neighbourOnRight) + + if (IsULeftConfiguration(neighbours, out var single) || IsULeftBisConfiguration(neighbours, out single)) { - return new Tuple(AdjacencyResolver.uRight, rotation, _placedObject.Direction); + return new Tuple(AdjacencyResolver.uLeft, rotation, _placedObject.Direction); } - else + + if (IsURightConfiguration(neighbours, out single) || IsURightBisConfiguration(neighbours, out single)) { - return new Tuple(AdjacencyResolver.uLeft, rotation, _placedObject.Direction); + return new Tuple(AdjacencyResolver.uRight, rotation, _placedObject.Direction); } + + Debug.LogError("should not reach this point"); + return new Tuple(AdjacencyResolver.o, 0, Direction.North); } /// /// In case a neighbour is in front or behind of this placed object, it should be the first neighbour parameter. /// no object should be null. /// - private Tuple UpdateMeshDirectionDoubleConnection(PlacedTileObject firstNeighbour, PlacedTileObject secondNeighbour) + private Tuple UpdateMeshDirectionDoubleConnection(List neighbours) { - // Cases for Lin - // this looks toward north, object in front looks toward east and object on the right side looks toward north. float rotation; Direction direction; - // first Lin - if (firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction) && firstNeighbour.IsInFront(_placedObject) - && secondNeighbour.IsOnRight(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) + if (IsFirstLInConfiguration(neighbours,out var first, out var second)) { - rotation = TileHelper.AngleBetween(Direction.North, secondNeighbour.Direction); - // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + rotation = TileHelper.AngleBetween(Direction.North, second.Direction); direction = _placedObject.Direction; return new Tuple(AdjacencyResolver.lIn, rotation, direction); } - //second Lin - if (firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction) && firstNeighbour.IsInFront(_placedObject) - && secondNeighbour.IsOnLeft(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) + if (IsSecondLInConfiguration(neighbours, out first, out second)) { // if the second neighbour is on left (the one facing the same direction), then the other // other side of the Lin couch should be linked to it, so we need to do a -90 degree rotation compared to neighbour on right. - rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousCardinalDir(secondNeighbour.Direction)); - // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousCardinalDir(second.Direction)); direction = _placedObject.Direction; return new Tuple(AdjacencyResolver.lIn, rotation, direction); } - // first LOut - // This looks toward north, behind looks toward west, and on the right looks toward north - if (firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction) && firstNeighbour.IsBehind(_placedObject) - && secondNeighbour.IsOnRight(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) + if (IsFirstLOutConfiguration(neighbours, out first, out second)) { - rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetNextCardinalDir(secondNeighbour.Direction)); - // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetNextCardinalDir(second.Direction)); direction = _placedObject.Direction; return new Tuple(AdjacencyResolver.lOut, rotation, direction); } - // second LOut - // This looks toward north, behind looks toward east, and on the left looks toward north - if (firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction) && firstNeighbour.IsBehind(_placedObject) - && secondNeighbour.IsOnLeft(_placedObject) && secondNeighbour.Direction == _placedObject.Direction) + if (IsSecondLOutConfiguration(neighbours, out first, out second)) { - rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetOpposite(secondNeighbour.Direction)); - // direction = TileHelper.GetDiagonalBetweenTwoCardinals(firstNeighbour.Direction, secondNeighbour.Direction); + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetOpposite(second.Direction)); direction = _placedObject.Direction; return new Tuple(AdjacencyResolver.lOut, rotation, direction); } - // I case - if(_placedObject.Direction == firstNeighbour.Direction && _placedObject.Direction == secondNeighbour.Direction) + if(IsIConfiguration(neighbours, out first, out second)) { - rotation = TileHelper.AngleBetween(Direction.North, secondNeighbour.Direction); - direction = firstNeighbour.Direction; + rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); + direction = first.Direction; return new Tuple(AdjacencyResolver.i, rotation, direction); } + Debug.LogError("should not reach this point"); + + return new Tuple(AdjacencyResolver.o, 0f, Direction.North); + } + + /// + /// (in case of this placed object turned toward north) + /// FirstLIn is when a neighbour is in front, looking toward east, and another neighbour on the right, + /// looking toward north as well. + /// + private bool IsFirstLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) + { + bool hasFront = HasNeighbourInFront(neighbours, out firstNeighbour); + bool hasRight = HasNeighbourOnRight(neighbours, out secondNeighbour); + + if (!(hasFront && hasRight)) return false; + + bool firstCondition = firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction); + bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + return firstCondition && secondCondition; + } + + /// + /// (in case of this placed object turned toward north) + /// SecondLIn is when a neighbour is in front, looking toward west, and another neighbour on the left, + /// looking toward north as well. + /// + private bool IsSecondLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) + { + bool hasFront = HasNeighbourInFront(neighbours, out firstNeighbour); + bool hasLeft = HasNeighbourOnLeft(neighbours, out secondNeighbour); + + if (!(hasFront && hasLeft)) return false; + + bool firstCondition = firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction); + bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + + return firstCondition && secondCondition; + } + + /// + /// (in case of this placed object turned toward north) + /// FirstLOut is when a neighbour is behind, looking toward west, and another neighbour on the right, + /// looking toward north as well. + /// + private bool IsFirstLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) + { + bool hasBehind = HasNeighbourBehind(neighbours, out firstNeighbour); + bool hasRight = HasNeighbourOnLeft(neighbours, out secondNeighbour); + + if (!(hasBehind && hasRight)) return false; + + bool firstCondition = firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction); + bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + + return firstCondition && secondCondition; + } + + /// + /// (in case of this placed object turned toward north) + /// SecondLOut is when a neighbour is behind, looking toward east, and another neighbour on the left, + /// looking toward north as well. + /// + private bool IsSecondLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) + { + bool hasBehind = HasNeighbourBehind(neighbours, out firstNeighbour); + bool hasLeft = HasNeighbourOnLeft(neighbours, out secondNeighbour); + + if (!(hasBehind && hasLeft)) return false; + + bool firstCondition = firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction); + bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + + return firstCondition && secondCondition; + } + + /// + /// + /// + private bool IsIConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) + { + bool hasLeft = HasNeighbourOnLeft(neighbours, out firstNeighbour); + bool hasRight = HasNeighbourOnRight(neighbours, out secondNeighbour); + + if (!(hasLeft && hasRight)) return false; + var firstConnector = firstNeighbour.GetComponent(); var secondConnector = secondNeighbour.GetComponent(); var neighboursOfFirst = firstConnector.GetNeighbourDirectionnal().Where(x => x != _placedObject).ToList(); - var neighboursOfSecond = secondConnector.GetNeighbourDirectionnal().Where(x => x != _placedObject).ToList() ; - - // second I Case, neighbours are facing cardinal directions from this, but they are connected to another one. - if ( - (_placedObject.Direction == firstNeighbour.Direction - || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) && - firstConnector.HasSingleConnection(neighboursOfFirst, out var n1))) - - && ((_placedObject.Direction == secondNeighbour.Direction) - || (secondNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) && - secondConnector.HasSingleConnection(neighboursOfSecond, out var n2))) - ) + var neighboursOfSecond = secondConnector.GetNeighbourDirectionnal().Where(x => x != _placedObject).ToList(); + + bool firstGoodDirection = _placedObject.Direction == firstNeighbour.Direction + || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) + && firstConnector.HasSingleConnection(neighboursOfFirst, out var n1)); + + bool secondGoodDirection = _placedObject.Direction == firstNeighbour.Direction + || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) + && firstConnector.HasSingleConnection(neighboursOfFirst, out var n2)); + + return firstGoodDirection && secondGoodDirection; + } + + /// + /// Neighbour is on left and looking in the same direction, it's a connection (Ushape) + /// + private bool IsULeftConfiguration(List neighbours, out PlacedTileObject single) + { + bool hasLeft = HasNeighbourOnLeft(neighbours, out single); + return hasLeft && single.Direction == _placedObject.Direction; + } + + /// + /// Neighbour is on right and looking in the same direction, it's a connection (Ushape) + /// + private bool IsURightConfiguration(List neighbours, out PlacedTileObject single) + { + bool hasRight = HasNeighbourOnRight(neighbours, out single); + return hasRight && single.Direction == _placedObject.Direction; + } + + /// + /// Neighbour is on right and has a double connection with one connection with this object + /// + private bool IsURightBisConfiguration(List neighbours, out PlacedTileObject single) + { + if(!HasNeighbourOnRight(neighbours, out single)) return false; + + var neighbourConnector = single.GetComponent(); + var neighbourNeighbours = neighbourConnector.GetNeighbourDirectionnal(); + if (neighbourConnector.HasDoubleConnection(neighbourNeighbours, out var first, out var second)) { - rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); - // rotation = TileHelper.AngleBetween(Direction.North, secondNeighbour.Direction); - direction = _placedObject.Direction; - return new Tuple(AdjacencyResolver.i, rotation, direction); + if (first == _placedObject || second == _placedObject) return true; } - Debug.LogError("should not reach this point"); + return false; + } - return new Tuple(AdjacencyResolver.o, 0f, Direction.North); + /// + /// Neighbour is on left and has a double connection with one connection with this object + /// + private bool IsULeftBisConfiguration(List neighbours, out PlacedTileObject single) + { + if (!HasNeighbourOnLeft(neighbours, out single)) return false; + + var neighbourConnector = single.GetComponent(); + var neighbourNeighbours = neighbourConnector.GetNeighbourDirectionnal(); + if (neighbourConnector.HasDoubleConnection(neighbourNeighbours, out var first, out var second)) + { + if (first == _placedObject || second == _placedObject) return true; + } + + return false; + } + + private bool HasNeighbourBehind(List neighbours, out PlacedTileObject behind) + { + foreach (var neighbour in neighbours) + { + if (neighbour.IsBehind(_placedObject)) + { + behind = neighbour; + return true; + } + } + + behind = null; + return false; + } + + private bool HasNeighbourInFront(List neighbours, out PlacedTileObject inFront) + { + foreach (var neighbour in neighbours) + { + if (neighbour.IsInFront(_placedObject)) + { + inFront = neighbour; + return true; + } + } + + inFront = null; + return false; + } + + private bool HasNeighbourOnRight(List neighbours, out PlacedTileObject onRight) + { + foreach (var neighbour in neighbours) + { + if (neighbour.IsOnRight(_placedObject)) + { + onRight = neighbour; + return true; + } + } + + onRight = null; + return false; + } + + private bool HasNeighbourOnLeft(List neighbours, out PlacedTileObject onLeft) + { + foreach (var neighbour in neighbours) + { + if (neighbour.IsOnLeft(_placedObject)) + { + onLeft = neighbour; + return true; + } + } + + onLeft = null; + return false; } } From 837b46e1f038cb87c8e4ff3461dddb330c662207 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 24 Oct 2023 12:30:38 +0200 Subject: [PATCH 38/87] some fix and update neighbours if itself get updated --- .../DirectionnalAdjacencyConnector.cs | 86 ++++++++++++------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 532f23989e..89837f2e1d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -44,6 +44,12 @@ public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector private bool _initialized; + private float _currentRotation; + + private AdjacencyShape _currentShape; + + + public override void OnStartClient() { base.OnStartClient(); @@ -87,7 +93,7 @@ public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) // ignore param public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { - UpdateAllAndNeighbours(true); + UpdateAllAndNeighbours(); } @@ -95,51 +101,67 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) // ignore param public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { - UpdateAllAndNeighbours(true); + UpdateAllAndNeighbours(); return true; } - private void UpdateAllAndNeighbours(bool updateNeighbours) + private void UpdateAllAndNeighbours() { Setup(); var neighbours = GetNeighbourDirectionnal(); - Tuple results; + Tuple results; if (HasSingleConnection(neighbours, out PlacedTileObject neighbour)) { - results = UpdateMeshDirectionSingleConnection(neighbours); + results = SelectMeshDirectionRotationSingleConnection(neighbours); } else if (HasDoubleConnection(neighbours, out PlacedTileObject first, out PlacedTileObject second)) { - results = UpdateMeshDirectionDoubleConnection(neighbours); + results = SelectMeshDirectionRotationDoubleConnection(neighbours); } // no connections then else { - results = new Tuple(AdjacencyResolver.o, - TileHelper.AngleBetween(Direction.North, _placedObject.Direction), _placedObject.Direction); + results = new Tuple(AdjacencyResolver.o, + TileHelper.AngleBetween(Direction.North, _placedObject.Direction), _placedObject.Direction, AdjacencyShape.O); } - _placedObject.SetDirection(results.Item3); - _filter.mesh = results.Item1; + bool updated = UpdateMeshRotationDirection(results.Item1, results.Item2, results.Item3, results.Item4); - Quaternion localRotation = transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, results.Item2, eulerRotation.z); - transform.localRotation = localRotation; + - if (updateNeighbours) + if (updated) { foreach(var adjacent in neighbours) { - adjacent.GetComponent().UpdateAllAndNeighbours(false); + adjacent.GetComponent().UpdateAllAndNeighbours(); } } } + private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, Direction direction, AdjacencyShape shape) + { + bool updated = direction != _placedObject.Direction; + updated |= rotation != _currentRotation; + updated |= shape != _currentShape; + + _currentShape = shape; + _currentRotation = rotation; + + _placedObject.SetDirection(direction); + _filter.mesh = mesh; + + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, rotation, eulerRotation.z); + transform.localRotation = localRotation; + + return updated; + } + private bool HasSingleConnection(List neighbours ,out PlacedTileObject neighbour) { neighbour = null; @@ -174,29 +196,29 @@ private List GetNeighbourDirectionnal() x.TryGetComponent(out var component)).ToList(); } - private Tuple UpdateMeshDirectionSingleConnection(List neighbours) + private Tuple SelectMeshDirectionRotationSingleConnection(List neighbours) { float rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); if (IsULeftConfiguration(neighbours, out var single) || IsULeftBisConfiguration(neighbours, out single)) { - return new Tuple(AdjacencyResolver.uLeft, rotation, _placedObject.Direction); + return new Tuple(AdjacencyResolver.uLeft, rotation, _placedObject.Direction, AdjacencyShape.ULeft); } if (IsURightConfiguration(neighbours, out single) || IsURightBisConfiguration(neighbours, out single)) { - return new Tuple(AdjacencyResolver.uRight, rotation, _placedObject.Direction); + return new Tuple(AdjacencyResolver.uRight, rotation, _placedObject.Direction, AdjacencyShape.URight); } Debug.LogError("should not reach this point"); - return new Tuple(AdjacencyResolver.o, 0, Direction.North); + return new Tuple(AdjacencyResolver.o, 0, Direction.North, AdjacencyShape.O); } /// /// In case a neighbour is in front or behind of this placed object, it should be the first neighbour parameter. /// no object should be null. /// - private Tuple UpdateMeshDirectionDoubleConnection(List neighbours) + private Tuple SelectMeshDirectionRotationDoubleConnection(List neighbours) { float rotation; Direction direction; @@ -205,7 +227,7 @@ private Tuple UpdateMeshDirectionDoubleConnection(List

(AdjacencyResolver.lIn, rotation, direction); + return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } if (IsSecondLInConfiguration(neighbours, out first, out second)) @@ -214,33 +236,33 @@ private Tuple UpdateMeshDirectionDoubleConnection(List

(AdjacencyResolver.lIn, rotation, direction); + return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } if (IsFirstLOutConfiguration(neighbours, out first, out second)) { rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetNextCardinalDir(second.Direction)); direction = _placedObject.Direction; - return new Tuple(AdjacencyResolver.lOut, rotation, direction); + return new Tuple(AdjacencyResolver.lOut, rotation, direction, AdjacencyShape.LOut); } if (IsSecondLOutConfiguration(neighbours, out first, out second)) { rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetOpposite(second.Direction)); direction = _placedObject.Direction; - return new Tuple(AdjacencyResolver.lOut, rotation, direction); + return new Tuple(AdjacencyResolver.lOut, rotation, direction, AdjacencyShape.LOut); } if(IsIConfiguration(neighbours, out first, out second)) { rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); - direction = first.Direction; - return new Tuple(AdjacencyResolver.i, rotation, direction); + direction = _placedObject.Direction; + return new Tuple(AdjacencyResolver.i, rotation, direction, AdjacencyShape.I); } Debug.LogError("should not reach this point"); - return new Tuple(AdjacencyResolver.o, 0f, Direction.North); + return new Tuple(AdjacencyResolver.o, 0f, Direction.North, AdjacencyShape.O); } ///

@@ -286,7 +308,7 @@ private bool IsSecondLInConfiguration(List neighbours, out Pla private bool IsFirstLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { bool hasBehind = HasNeighbourBehind(neighbours, out firstNeighbour); - bool hasRight = HasNeighbourOnLeft(neighbours, out secondNeighbour); + bool hasRight = HasNeighbourOnRight(neighbours, out secondNeighbour); if (!(hasBehind && hasRight)) return false; @@ -334,9 +356,9 @@ private bool IsIConfiguration(List neighbours, out PlacedTileO || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) && firstConnector.HasSingleConnection(neighboursOfFirst, out var n1)); - bool secondGoodDirection = _placedObject.Direction == firstNeighbour.Direction - || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) - && firstConnector.HasSingleConnection(neighboursOfFirst, out var n2)); + bool secondGoodDirection = _placedObject.Direction == secondNeighbour.Direction + || (secondNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) + && secondConnector.HasSingleConnection(neighboursOfSecond, out n1)); return firstGoodDirection && secondGoodDirection; } From c9723ac6726305c6a440208edf8127599dcabcc5 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 24 Oct 2023 15:32:47 +0200 Subject: [PATCH 39/87] add connection number --- .../DirectionnalAdjacencyConnector.cs | 89 ++++++++++++------- 1 file changed, 59 insertions(+), 30 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 89837f2e1d..0fc7970f6a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -11,6 +11,7 @@ using System.Linq; using UnityEngine; using UnityEngine.PlayerLoop; +using UnityEngine.UIElements; using static UnityEngine.InputSystem.LowLevel.InputStateHistory; using static UnityEngine.ParticleSystem; @@ -46,6 +47,8 @@ public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector private float _currentRotation; + private int _currentConnections; + private AdjacencyShape _currentShape; @@ -109,17 +112,20 @@ private void UpdateAllAndNeighbours() { Setup(); var neighbours = GetNeighbourDirectionnal(); + int connections = 0; Tuple results; if (HasSingleConnection(neighbours, out PlacedTileObject neighbour)) { results = SelectMeshDirectionRotationSingleConnection(neighbours); + connections = 1; } else if (HasDoubleConnection(neighbours, out PlacedTileObject first, out PlacedTileObject second)) { results = SelectMeshDirectionRotationDoubleConnection(neighbours); + connections = 2; } // no connections then @@ -127,9 +133,10 @@ private void UpdateAllAndNeighbours() { results = new Tuple(AdjacencyResolver.o, TileHelper.AngleBetween(Direction.North, _placedObject.Direction), _placedObject.Direction, AdjacencyShape.O); + connections = 0; } - bool updated = UpdateMeshRotationDirection(results.Item1, results.Item2, results.Item3, results.Item4); + bool updated = UpdateMeshRotationDirection(results.Item1, results.Item2, results.Item3, results.Item4, connections); @@ -142,14 +149,17 @@ private void UpdateAllAndNeighbours() } } - private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, Direction direction, AdjacencyShape shape) + private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, Direction direction, AdjacencyShape shape, int connectionNumbers) { bool updated = direction != _placedObject.Direction; updated |= rotation != _currentRotation; updated |= shape != _currentShape; + updated |= connectionNumbers != _currentConnections; _currentShape = shape; _currentRotation = rotation; + _currentConnections = connectionNumbers; + _placedObject.SetDirection(direction); _filter.mesh = mesh; @@ -223,7 +233,14 @@ private Tuple SelectMeshDirectionRotatio float rotation; Direction direction; - if (IsFirstLInConfiguration(neighbours,out var first, out var second)) + if (IsIConfiguration(neighbours, out var first, out var second)) + { + rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); + direction = _placedObject.Direction; + return new Tuple(AdjacencyResolver.i, rotation, direction, AdjacencyShape.I); + } + + if (IsFirstLInConfiguration(neighbours,out first, out second)) { rotation = TileHelper.AngleBetween(Direction.North, second.Direction); direction = _placedObject.Direction; @@ -253,13 +270,6 @@ private Tuple SelectMeshDirectionRotatio return new Tuple(AdjacencyResolver.lOut, rotation, direction, AdjacencyShape.LOut); } - if(IsIConfiguration(neighbours, out first, out second)) - { - rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); - direction = _placedObject.Direction; - return new Tuple(AdjacencyResolver.i, rotation, direction, AdjacencyShape.I); - } - Debug.LogError("should not reach this point"); return new Tuple(AdjacencyResolver.o, 0f, Direction.North, AdjacencyShape.O); @@ -346,19 +356,13 @@ private bool IsIConfiguration(List neighbours, out PlacedTileO if (!(hasLeft && hasRight)) return false; - var firstConnector = firstNeighbour.GetComponent(); - var secondConnector = secondNeighbour.GetComponent(); - - var neighboursOfFirst = firstConnector.GetNeighbourDirectionnal().Where(x => x != _placedObject).ToList(); - var neighboursOfSecond = secondConnector.GetNeighbourDirectionnal().Where(x => x != _placedObject).ToList(); - bool firstGoodDirection = _placedObject.Direction == firstNeighbour.Direction || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) - && firstConnector.HasSingleConnection(neighboursOfFirst, out var n1)); + && DirectionnalHasSingleConnection(firstNeighbour, out var n1, true)); bool secondGoodDirection = _placedObject.Direction == secondNeighbour.Direction || (secondNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) - && secondConnector.HasSingleConnection(neighboursOfSecond, out n1)); + && DirectionnalHasSingleConnection(secondNeighbour, out n1, true)); return firstGoodDirection && secondGoodDirection; } @@ -368,8 +372,11 @@ private bool IsIConfiguration(List neighbours, out PlacedTileO /// private bool IsULeftConfiguration(List neighbours, out PlacedTileObject single) { - bool hasLeft = HasNeighbourOnLeft(neighbours, out single); - return hasLeft && single.Direction == _placedObject.Direction; + if(!HasNeighbourOnLeft(neighbours, out single)) return false; + + bool firstCondition = single.Direction == _placedObject.Direction; + bool secondCondition = !DirectionnalHasTwoConnections(single, out var n1, out var n2, true); + return firstCondition && secondCondition; } /// @@ -377,8 +384,10 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT /// private bool IsURightConfiguration(List neighbours, out PlacedTileObject single) { - bool hasRight = HasNeighbourOnRight(neighbours, out single); - return hasRight && single.Direction == _placedObject.Direction; + if (!HasNeighbourOnRight(neighbours, out single)) return false; + + return single.Direction == _placedObject.Direction + && !DirectionnalHasTwoConnections(single, out var n1, out var n2, true); } /// @@ -388,11 +397,12 @@ private bool IsURightBisConfiguration(List neighbours, out Pla { if(!HasNeighbourOnRight(neighbours, out single)) return false; - var neighbourConnector = single.GetComponent(); - var neighbourNeighbours = neighbourConnector.GetNeighbourDirectionnal(); - if (neighbourConnector.HasDoubleConnection(neighbourNeighbours, out var first, out var second)) + if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) { - if (first == _placedObject || second == _placedObject) return true; + if (first == _placedObject || second == _placedObject) + { + return true; + } } return false; @@ -405,11 +415,12 @@ private bool IsULeftBisConfiguration(List neighbours, out Plac { if (!HasNeighbourOnLeft(neighbours, out single)) return false; - var neighbourConnector = single.GetComponent(); - var neighbourNeighbours = neighbourConnector.GetNeighbourDirectionnal(); - if (neighbourConnector.HasDoubleConnection(neighbourNeighbours, out var first, out var second)) + if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) { - if (first == _placedObject || second == _placedObject) return true; + if (first == _placedObject || second == _placedObject) + { + return true; + } } return false; @@ -474,6 +485,24 @@ private bool HasNeighbourOnLeft(List neighbours, out PlacedTil onLeft = null; return false; } + + private bool DirectionnalHasTwoConnections(PlacedTileObject directionnal, + out PlacedTileObject first, out PlacedTileObject second, bool excludingThis) + { + var directionnalConnector = directionnal.GetComponent(); + var directionnalNeighbours = directionnalConnector.GetNeighbourDirectionnal(); + if (excludingThis) directionnalNeighbours.Remove(_placedObject); + return directionnalConnector.HasDoubleConnection(directionnalNeighbours, out first, out second); + } + + private bool DirectionnalHasSingleConnection(PlacedTileObject directionnal, out PlacedTileObject first, + bool excludingThis) + { + var directionnalConnector = directionnal.GetComponent(); + var directionnalNeighbours = directionnalConnector.GetNeighbourDirectionnal(); + if(excludingThis) directionnalNeighbours.Remove(_placedObject); + return directionnalConnector.HasSingleConnection(directionnalNeighbours, out first); + } } From f87879583000b7310b468478ee97b108c5877bd1 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 24 Oct 2023 17:42:25 +0200 Subject: [PATCH 40/87] add condition for u shapes --- .../DirectionnalAdjacencyConnector.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 0fc7970f6a..75e8c6db8f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -96,7 +96,10 @@ public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) // ignore param public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { - UpdateAllAndNeighbours(); + foreach(var neighbourObject in neighbourObjects) + { + UpdateAllAndNeighbours(neighbourObject != null); + } } @@ -104,11 +107,11 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) // ignore param public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { - UpdateAllAndNeighbours(); + UpdateAllAndNeighbours(neighbourObject != null); return true; } - private void UpdateAllAndNeighbours() + private void UpdateAllAndNeighbours(bool neighbourPresent) { Setup(); var neighbours = GetNeighbourDirectionnal(); @@ -144,7 +147,7 @@ private void UpdateAllAndNeighbours() { foreach(var adjacent in neighbours) { - adjacent.GetComponent().UpdateAllAndNeighbours(); + adjacent.GetComponent().UpdateAllAndNeighbours(adjacent != null); } } } @@ -397,7 +400,12 @@ private bool IsURightBisConfiguration(List neighbours, out Pla { if(!HasNeighbourOnRight(neighbours, out single)) return false; - if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) + if(DirectionnalHasTwoConnections(single, out var first, out var second, true)) + { + return false; + } + + if (DirectionnalHasTwoConnections(single, out first, out second, false)) { if (first == _placedObject || second == _placedObject) { @@ -415,7 +423,12 @@ private bool IsULeftBisConfiguration(List neighbours, out Plac { if (!HasNeighbourOnLeft(neighbours, out single)) return false; - if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) + if (DirectionnalHasTwoConnections(single, out var first, out var second, true)) + { + return false; + } + + if (DirectionnalHasTwoConnections(single, out first, out second, false)) { if (first == _placedObject || second == _placedObject) { From 3f955cfd1447cfb0a16d77bd0c41b86f63416141 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 24 Oct 2023 18:50:51 +0200 Subject: [PATCH 41/87] remove conditions and keep only neighbours with lt 2 connections --- .../DirectionnalAdjacencyConnector.cs | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 75e8c6db8f..4a76b2d9a3 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -98,7 +98,7 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { foreach(var neighbourObject in neighbourObjects) { - UpdateAllAndNeighbours(neighbourObject != null); + UpdateAllAndNeighbours(true); } } @@ -107,14 +107,16 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) // ignore param public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { - UpdateAllAndNeighbours(neighbourObject != null); + UpdateAllAndNeighbours(true); return true; } - private void UpdateAllAndNeighbours(bool neighbourPresent) + private void UpdateAllAndNeighbours(bool updateNeighbour) { Setup(); var neighbours = GetNeighbourDirectionnal(); + neighbours = neighbours.Where(x => + !DirectionnalHasTwoConnections(x, out var first, out var second, true)).ToList(); int connections = 0; Tuple results; @@ -142,12 +144,12 @@ private void UpdateAllAndNeighbours(bool neighbourPresent) bool updated = UpdateMeshRotationDirection(results.Item1, results.Item2, results.Item3, results.Item4, connections); - - if (updated) + // update all neighbours the first time, then update only neighbours if this is updated. + if (updated || updateNeighbour) { foreach(var adjacent in neighbours) { - adjacent.GetComponent().UpdateAllAndNeighbours(adjacent != null); + adjacent.GetComponent().UpdateAllAndNeighbours(false); } } } @@ -378,8 +380,7 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT if(!HasNeighbourOnLeft(neighbours, out single)) return false; bool firstCondition = single.Direction == _placedObject.Direction; - bool secondCondition = !DirectionnalHasTwoConnections(single, out var n1, out var n2, true); - return firstCondition && secondCondition; + return firstCondition; } /// @@ -389,8 +390,8 @@ private bool IsURightConfiguration(List neighbours, out Placed { if (!HasNeighbourOnRight(neighbours, out single)) return false; - return single.Direction == _placedObject.Direction - && !DirectionnalHasTwoConnections(single, out var n1, out var n2, true); + return single.Direction == _placedObject.Direction; + } /// @@ -400,12 +401,7 @@ private bool IsURightBisConfiguration(List neighbours, out Pla { if(!HasNeighbourOnRight(neighbours, out single)) return false; - if(DirectionnalHasTwoConnections(single, out var first, out var second, true)) - { - return false; - } - - if (DirectionnalHasTwoConnections(single, out first, out second, false)) + if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) { if (first == _placedObject || second == _placedObject) { @@ -423,12 +419,7 @@ private bool IsULeftBisConfiguration(List neighbours, out Plac { if (!HasNeighbourOnLeft(neighbours, out single)) return false; - if (DirectionnalHasTwoConnections(single, out var first, out var second, true)) - { - return false; - } - - if (DirectionnalHasTwoConnections(single, out first, out second, false)) + if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) { if (first == _placedObject || second == _placedObject) { From 67bad3baf52b5f392736795b91975acfa2e1c7ad Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 25 Oct 2023 00:06:19 +0200 Subject: [PATCH 42/87] add diagonal directions for lin lout --- .../DirectionnalAdjacencyConnector.cs | 244 ++++++++++++------ 1 file changed, 170 insertions(+), 74 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 4a76b2d9a3..d2e85e3093 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -184,9 +184,7 @@ private bool HasSingleConnection(List neighbours ,out PlacedTi // has double connection, therefore not a single one. if(HasDoubleConnection(neighbours, out var first, out var second)) return false; - return IsULeftBisConfiguration(neighbours, out var single) - || IsURightBisConfiguration(neighbours, out single) - || IsULeftConfiguration(neighbours, out single) + return IsULeftConfiguration(neighbours, out var single) || IsURightConfiguration(neighbours, out single); } @@ -215,12 +213,12 @@ private Tuple SelectMeshDirectionRotationS { float rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); - if (IsULeftConfiguration(neighbours, out var single) || IsULeftBisConfiguration(neighbours, out single)) + if (IsULeftConfiguration(neighbours, out var single)) { return new Tuple(AdjacencyResolver.uLeft, rotation, _placedObject.Direction, AdjacencyShape.ULeft); } - if (IsURightConfiguration(neighbours, out single) || IsURightBisConfiguration(neighbours, out single)) + if (IsURightConfiguration(neighbours, out single)) { return new Tuple(AdjacencyResolver.uRight, rotation, _placedObject.Direction, AdjacencyShape.URight); } @@ -248,7 +246,9 @@ private Tuple SelectMeshDirectionRotatio if (IsFirstLInConfiguration(neighbours,out first, out second)) { rotation = TileHelper.AngleBetween(Direction.North, second.Direction); - direction = _placedObject.Direction; + var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); + var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); + direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } @@ -257,21 +257,27 @@ private Tuple SelectMeshDirectionRotatio // if the second neighbour is on left (the one facing the same direction), then the other // other side of the Lin couch should be linked to it, so we need to do a -90 degree rotation compared to neighbour on right. rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousCardinalDir(second.Direction)); - direction = _placedObject.Direction; + var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); + var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); + direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } if (IsFirstLOutConfiguration(neighbours, out first, out second)) { - rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetNextCardinalDir(second.Direction)); - direction = _placedObject.Direction; + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetNextCardinalDir(first.Direction)); + var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); + var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); + direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); return new Tuple(AdjacencyResolver.lOut, rotation, direction, AdjacencyShape.LOut); } if (IsSecondLOutConfiguration(neighbours, out first, out second)) { rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetOpposite(second.Direction)); - direction = _placedObject.Direction; + var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); + var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); + direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); return new Tuple(AdjacencyResolver.lOut, rotation, direction, AdjacencyShape.LOut); } @@ -287,13 +293,41 @@ private Tuple SelectMeshDirectionRotatio /// private bool IsFirstLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - bool hasFront = HasNeighbourInFront(neighbours, out firstNeighbour); - bool hasRight = HasNeighbourOnRight(neighbours, out secondNeighbour); + // Seems to work ! Need to do the same for all L config and I config. + bool hasFirstCorrect; + bool hasSecondCorrect; + List firstAllowedDirections; + List secondAllowedDirections; + + // check front and right when this placed object is facing a cardinal direction, + // otherwise check if directionnables are at adjacent directions. + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + hasFirstCorrect = HasNeighbourInFront(neighbours, out firstNeighbour); + hasSecondCorrect = HasNeighbourOnRight(neighbours, out secondNeighbour); + } + else + { + var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); + hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, directions[1]); + hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, directions[0]); + } + + if (!(hasFirstCorrect && hasSecondCorrect)) return false; - if (!(hasFront && hasRight)) return false; + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(TileHelper.GetPreviousCardinalDir(firstNeighbour.Direction)); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } + else + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } - bool firstCondition = firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction); - bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); + bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); return firstCondition && secondCondition; } @@ -304,14 +338,41 @@ private bool IsFirstLInConfiguration(List neighbours, out Plac /// private bool IsSecondLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - bool hasFront = HasNeighbourInFront(neighbours, out firstNeighbour); - bool hasLeft = HasNeighbourOnLeft(neighbours, out secondNeighbour); + // Seems to work ! Need to do the same for all L config and I config. + bool hasFirstCorrect; + bool hasSecondCorrect; + List firstAllowedDirections; + List secondAllowedDirections; + + // check front and right when this placed object is facing a cardinal direction, + // otherwise check if directionnables are at adjacent directions. + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + hasFirstCorrect = HasNeighbourInFront(neighbours, out firstNeighbour); + hasSecondCorrect = HasNeighbourOnLeft(neighbours, out secondNeighbour); + } + else + { + var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); + hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, directions[1]); + hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, directions[0]); + } - if (!(hasFront && hasLeft)) return false; + if (!(hasFirstCorrect && hasSecondCorrect)) return false; - bool firstCondition = firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction); - bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(TileHelper.GetNextCardinalDir(firstNeighbour.Direction)); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } + else + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } + bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); + bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); return firstCondition && secondCondition; } @@ -322,14 +383,41 @@ private bool IsSecondLInConfiguration(List neighbours, out Pla /// private bool IsFirstLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - bool hasBehind = HasNeighbourBehind(neighbours, out firstNeighbour); - bool hasRight = HasNeighbourOnRight(neighbours, out secondNeighbour); + // Seems to work ! Need to do the same for all L config and I config. + bool hasFirstCorrect; + bool hasSecondCorrect; + List firstAllowedDirections; + List secondAllowedDirections; + + // check front and right when this placed object is facing a cardinal direction, + // otherwise check if directionnables are at adjacent directions. + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + hasFirstCorrect = HasNeighbourBehind(neighbours, out firstNeighbour); + hasSecondCorrect = HasNeighbourOnRight(neighbours, out secondNeighbour); + } + else + { + var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); + hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, TileHelper.GetOpposite(directions[1])); + hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, TileHelper.GetOpposite(directions[0])); + } - if (!(hasBehind && hasRight)) return false; + if (!(hasFirstCorrect && hasSecondCorrect)) return false; - bool firstCondition = firstNeighbour.Direction == TileHelper.GetPreviousCardinalDir(_placedObject.Direction); - bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(TileHelper.GetNextCardinalDir(firstNeighbour.Direction)); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } + else + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } + bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); + bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); return firstCondition && secondCondition; } @@ -340,14 +428,41 @@ private bool IsFirstLOutConfiguration(List neighbours, out Pla ///
private bool IsSecondLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - bool hasBehind = HasNeighbourBehind(neighbours, out firstNeighbour); - bool hasLeft = HasNeighbourOnLeft(neighbours, out secondNeighbour); + // Seems to work ! Need to do the same for all L config and I config. + bool hasFirstCorrect; + bool hasSecondCorrect; + List firstAllowedDirections; + List secondAllowedDirections; + + // check front and right when this placed object is facing a cardinal direction, + // otherwise check if directionnables are at adjacent directions. + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + hasFirstCorrect = HasNeighbourBehind(neighbours, out firstNeighbour); + hasSecondCorrect = HasNeighbourOnLeft(neighbours, out secondNeighbour); + } + else + { + var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); + hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, TileHelper.GetOpposite(directions[1])); + hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, TileHelper.GetOpposite(directions[0])); + } - if (!(hasBehind && hasLeft)) return false; + if (!(hasFirstCorrect && hasSecondCorrect)) return false; - bool firstCondition = firstNeighbour.Direction == TileHelper.GetNextCardinalDir(_placedObject.Direction); - bool secondCondition = secondNeighbour.Direction == _placedObject.Direction; + if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(TileHelper.GetPreviousCardinalDir(firstNeighbour.Direction)); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } + else + { + firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + } + bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); + bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); return firstCondition && secondCondition; } @@ -361,13 +476,11 @@ private bool IsIConfiguration(List neighbours, out PlacedTileO if (!(hasLeft && hasRight)) return false; - bool firstGoodDirection = _placedObject.Direction == firstNeighbour.Direction - || (firstNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) - && DirectionnalHasSingleConnection(firstNeighbour, out var n1, true)); + var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); + + bool firstGoodDirection = AllowedDirections.Contains(firstNeighbour.Direction); - bool secondGoodDirection = _placedObject.Direction == secondNeighbour.Direction - || (secondNeighbour.Direction != TileHelper.GetOpposite(_placedObject.Direction) - && DirectionnalHasSingleConnection(secondNeighbour, out n1, true)); + bool secondGoodDirection = AllowedDirections.Contains(secondNeighbour.Direction); return firstGoodDirection && secondGoodDirection; } @@ -379,7 +492,9 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT { if(!HasNeighbourOnLeft(neighbours, out single)) return false; - bool firstCondition = single.Direction == _placedObject.Direction; + var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); + bool firstCondition = AllowedDirections.Contains(single.Direction); + return firstCondition; } @@ -390,44 +505,10 @@ private bool IsURightConfiguration(List neighbours, out Placed { if (!HasNeighbourOnRight(neighbours, out single)) return false; - return single.Direction == _placedObject.Direction; - - } - - /// - /// Neighbour is on right and has a double connection with one connection with this object - /// - private bool IsURightBisConfiguration(List neighbours, out PlacedTileObject single) - { - if(!HasNeighbourOnRight(neighbours, out single)) return false; - - if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) - { - if (first == _placedObject || second == _placedObject) - { - return true; - } - } - - return false; - } - - /// - /// Neighbour is on left and has a double connection with one connection with this object - /// - private bool IsULeftBisConfiguration(List neighbours, out PlacedTileObject single) - { - if (!HasNeighbourOnLeft(neighbours, out single)) return false; + var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); + bool firstCondition = AllowedDirections.Contains(single.Direction); - if (DirectionnalHasTwoConnections(single, out var first, out var second, false)) - { - if (first == _placedObject || second == _placedObject) - { - return true; - } - } - - return false; + return firstCondition; } private bool HasNeighbourBehind(List neighbours, out PlacedTileObject behind) @@ -490,6 +571,21 @@ private bool HasNeighbourOnLeft(List neighbours, out PlacedTil return false; } + private bool HasNeighbourAtDirection(List neighbours, out PlacedTileObject atDirection, Direction dir) + { + foreach (var neighbour in neighbours) + { + if (_placedObject.AtDirectionOf(neighbour, dir)) + { + atDirection = neighbour; + return true; + } + } + + atDirection = null; + return false; + } + private bool DirectionnalHasTwoConnections(PlacedTileObject directionnal, out PlacedTileObject first, out PlacedTileObject second, bool excludingThis) { From 4c1ba3168f03b050da0bbf16c378494ec1a46e87 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 26 Oct 2023 13:28:05 +0200 Subject: [PATCH 43/87] update comments --- .../Tile/Connections/DirectionnalAdjacencyConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index d2e85e3093..4b78bf64e8 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -145,6 +145,7 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) // update all neighbours the first time, then update only neighbours if this is updated. + // TODO update only the connected ones ? if (updated || updateNeighbour) { foreach(var adjacent in neighbours) @@ -338,13 +339,12 @@ private bool IsFirstLInConfiguration(List neighbours, out Plac ///
private bool IsSecondLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - // Seems to work ! Need to do the same for all L config and I config. bool hasFirstCorrect; bool hasSecondCorrect; List firstAllowedDirections; List secondAllowedDirections; - // check front and right when this placed object is facing a cardinal direction, + // check front and left when this placed object is facing a cardinal direction, // otherwise check if directionnables are at adjacent directions. if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) { From 8de3558feee8d2be37f461120e7cc26bf046f4c4 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 30 Oct 2023 14:19:46 +0100 Subject: [PATCH 44/87] fixing more adjacencies --- .../DirectionnalAdjacencyConnector.cs | 152 +++++++++++++++--- 1 file changed, 129 insertions(+), 23 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 4b78bf64e8..3943121630 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -51,6 +51,9 @@ public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector private AdjacencyShape _currentShape; + private PlacedTileObject _firstNeighbour; + + private PlacedTileObject _secondNeighbour; public override void OnStartClient() @@ -115,8 +118,7 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) { Setup(); var neighbours = GetNeighbourDirectionnal(); - neighbours = neighbours.Where(x => - !DirectionnalHasTwoConnections(x, out var first, out var second, true)).ToList(); + neighbours = neighbours.Where(x => !DirectionnalAlreadyHasTwoConnections(x, true)).ToList(); int connections = 0; Tuple results; @@ -125,12 +127,16 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) { results = SelectMeshDirectionRotationSingleConnection(neighbours); connections = 1; + _firstNeighbour = neighbour; + _secondNeighbour = null; } else if (HasDoubleConnection(neighbours, out PlacedTileObject first, out PlacedTileObject second)) { results = SelectMeshDirectionRotationDoubleConnection(neighbours); connections = 2; + _firstNeighbour = first; + _secondNeighbour = second; } // no connections then @@ -139,6 +145,8 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) results = new Tuple(AdjacencyResolver.o, TileHelper.AngleBetween(Direction.North, _placedObject.Direction), _placedObject.Direction, AdjacencyShape.O); connections = 0; + _firstNeighbour = null; + _secondNeighbour = null; } bool updated = UpdateMeshRotationDirection(results.Item1, results.Item2, results.Item3, results.Item4, connections); @@ -185,17 +193,17 @@ private bool HasSingleConnection(List neighbours ,out PlacedTi // has double connection, therefore not a single one. if(HasDoubleConnection(neighbours, out var first, out var second)) return false; - return IsULeftConfiguration(neighbours, out var single) - || IsURightConfiguration(neighbours, out single); + return IsULeftConfiguration(neighbours, out neighbour) + || IsURightConfiguration(neighbours, out neighbour); } private bool HasDoubleConnection(List neighbours, out PlacedTileObject first, out PlacedTileObject second) { - return IsFirstLInConfiguration(neighbours, out first, out second) + return IsIConfiguration(neighbours, out first, out second) + || IsFirstLInConfiguration(neighbours, out first, out second) || IsSecondLInConfiguration(neighbours, out first, out second) || IsFirstLOutConfiguration(neighbours, out first, out second) - || IsSecondLOutConfiguration(neighbours, out first, out second) - || IsIConfiguration(neighbours, out first, out second); + || IsSecondLOutConfiguration(neighbours, out first, out second); } @@ -212,20 +220,63 @@ private List GetNeighbourDirectionnal() private Tuple SelectMeshDirectionRotationSingleConnection(List neighbours) { - float rotation = TileHelper.AngleBetween(Direction.North, _placedObject.Direction); + float rotation; + Direction direction; + AdjacencyShape shape; + Mesh mesh; if (IsULeftConfiguration(neighbours, out var single)) { - return new Tuple(AdjacencyResolver.uLeft, rotation, _placedObject.Direction, AdjacencyShape.ULeft); + shape = AdjacencyShape.ULeft; + mesh = AdjacencyResolver.uLeft; } + else if (IsURightConfiguration(neighbours, out single)) + { + shape = AdjacencyShape.URight; + mesh = AdjacencyResolver.uRight; + } + else + { + Debug.LogError("should not reach this point"); + return new Tuple(AdjacencyResolver.o, 0, Direction.North, AdjacencyShape.O); + } + + direction = _placedObject.Direction; - if (IsURightConfiguration(neighbours, out single)) + // if placedObject is currently facing diagonal directions + // change its direction with an adjacent one such + // that it keeps connection with the neighbour. + if (!TileHelper.CardinalDirections().Contains(_placedObject.Direction)) { - return new Tuple(AdjacencyResolver.uRight, rotation, _placedObject.Direction, AdjacencyShape.URight); + var adjacents = TileHelper.GetAdjacentDirections(_placedObject.Direction); + Direction original = _placedObject.Direction; + if(shape == AdjacencyShape.ULeft) + { + _placedObject.SetDirection(adjacents[0]); + if (IsULeftConfiguration(neighbours, out var temp) && temp == single) + direction = adjacents[0]; + _placedObject.SetDirection(adjacents[1]); + if (IsULeftConfiguration(neighbours, out temp) && temp == single) + direction = adjacents[1]; + } + else if (shape == AdjacencyShape.URight) + { + _placedObject.SetDirection(adjacents[0]); + if (IsURightConfiguration(neighbours, out var temp) && temp == single) + direction = adjacents[0]; + _placedObject.SetDirection(adjacents[1]); + if (IsURightConfiguration(neighbours, out temp) && temp == single) + direction = adjacents[1]; + } } + else + { + direction = _placedObject.Direction; + } + + rotation = TileHelper.AngleBetween(Direction.North, direction); - Debug.LogError("should not reach this point"); - return new Tuple(AdjacencyResolver.o, 0, Direction.North, AdjacencyShape.O); + return new Tuple(mesh, rotation, direction, shape); } /// @@ -428,7 +479,6 @@ private bool IsFirstLOutConfiguration(List neighbours, out Pla /// private bool IsSecondLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - // Seems to work ! Need to do the same for all L config and I config. bool hasFirstCorrect; bool hasSecondCorrect; List firstAllowedDirections; @@ -490,9 +540,33 @@ private bool IsIConfiguration(List neighbours, out PlacedTileO ///
private bool IsULeftConfiguration(List neighbours, out PlacedTileObject single) { - if(!HasNeighbourOnLeft(neighbours, out single)) return false; + Direction original = _placedObject.Direction; + bool diagonal = false; + List adjacents = TileHelper.GetAdjacentDirections(_placedObject.Direction); + + if (!TileHelper.CardinalDirections().Contains(original)) diagonal = true; + + if (diagonal) + { + _placedObject.SetDirection(adjacents[0]); + bool hasNeighbourFirstCardinal = HasNeighbourOnLeft(neighbours, out var firstCardinal); + _placedObject.SetDirection(adjacents[1]); + bool hasNeighbourSecondCardinal = HasNeighbourOnLeft(neighbours, out var secondCardinal); - var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); + if (hasNeighbourFirstCardinal) single = firstCardinal; + else if (hasNeighbourSecondCardinal) single = secondCardinal; + else single = null; + } + else + { + HasNeighbourOnLeft(neighbours, out single); + } + + _placedObject.SetDirection(original); + + if (single == null) return false; + + var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); bool firstCondition = AllowedDirections.Contains(single.Direction); return firstCondition; @@ -503,7 +577,31 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT ///
private bool IsURightConfiguration(List neighbours, out PlacedTileObject single) { - if (!HasNeighbourOnRight(neighbours, out single)) return false; + Direction original = _placedObject.Direction; + bool diagonal = false; + List adjacents = TileHelper.GetAdjacentDirections(_placedObject.Direction); + + if (!TileHelper.CardinalDirections().Contains(original)) diagonal = true; + + if (diagonal) + { + _placedObject.SetDirection(adjacents[0]); + bool hasNeighbourFirstCardinal = HasNeighbourOnRight(neighbours, out var firstCardinal); + _placedObject.SetDirection(adjacents[1]); + bool hasNeighbourSecondCardinal = HasNeighbourOnRight(neighbours, out var secondCardinal); + + if (hasNeighbourFirstCardinal) single = firstCardinal; + else if (hasNeighbourSecondCardinal) single = secondCardinal; + else single = null; + } + else + { + HasNeighbourOnRight(neighbours, out single); + } + + _placedObject.SetDirection(original); + + if (single == null) return false; var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); bool firstCondition = AllowedDirections.Contains(single.Direction); @@ -586,13 +684,21 @@ private bool HasNeighbourAtDirection(List neighbours, out Plac return false; } - private bool DirectionnalHasTwoConnections(PlacedTileObject directionnal, - out PlacedTileObject first, out PlacedTileObject second, bool excludingThis) + private bool DirectionnalAlreadyHasTwoConnections(PlacedTileObject directionnal, bool excludingThis) { - var directionnalConnector = directionnal.GetComponent(); - var directionnalNeighbours = directionnalConnector.GetNeighbourDirectionnal(); - if (excludingThis) directionnalNeighbours.Remove(_placedObject); - return directionnalConnector.HasDoubleConnection(directionnalNeighbours, out first, out second); + var neighbourConnector = directionnal.GetComponent(); + if (neighbourConnector._currentConnections == 2) + { + if (excludingThis && + (neighbourConnector._firstNeighbour.GetComponent() == this + || neighbourConnector._secondNeighbour.GetComponent() == this)) + { + return false; + } + return true; + + } + return false; } private bool DirectionnalHasSingleConnection(PlacedTileObject directionnal, out PlacedTileObject first, From bb9b20aa54179c860969f691a5de183510f0a09f Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 30 Oct 2023 15:22:12 +0100 Subject: [PATCH 45/87] add some helper method --- .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index dc70c95e1f..48f6579ed5 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -165,6 +165,51 @@ public static Direction GetCardinalBetweenTwoDiagonals(Direction diagonal1, Dire givenDiagonals.Contains(Direction.SouthWest) ? Direction.West : Direction.North; } + /// + /// Shortest distance between two directions, in the sense of the number of 45 degree rotation needed + /// to get from one direction to another. + /// + public static int DistanceBetweenDir(Direction dir1, Direction dir2) + { + int dist1 = MathUtility.mod(dir1 - dir2, 8); + int dist2 = MathUtility.mod(dir2 - dir1, 8); + return Math.Min(dist1, dist2); + } + + /// + /// return the closest diagonal from two other directions. + /// There isn't necessarily a single diagonal which works, take the case of two opposite directions, + /// then all diagonals work. In case of two adjacent diagonals, it returns the first one. + /// + public static Direction ClosestDiagonalFromTwo(Direction dir1, Direction dir2) + { + if(IsDiagonal(dir1) && IsDiagonal(dir2) && DistanceBetweenDir(dir1, dir2) == 2) + { + return dir1; + } + + Direction res = Direction.NorthEast; + int minDistance = int.MaxValue; + int distance; + foreach(Direction diagonal in DiagonalDirections()) + { + distance = (int) Math.Pow(DistanceBetweenDir(dir1, diagonal),2) + + (int) Math.Pow(DistanceBetweenDir(dir2, diagonal),2); + if(distance < minDistance) + { + minDistance = distance; + res = diagonal; + } + } + + return res; + } + + public static bool IsDiagonal(Direction dir) + { + return DiagonalDirections().Contains(dir); + } + /// /// Return the angle between two directions, clock wise is positive. /// From 9d786d97400384f0ee6bd82b036370d5337d76cb Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 30 Oct 2023 15:47:33 +0100 Subject: [PATCH 46/87] almost there --- .../DirectionnalAdjacencyConnector.cs | 34 +++++++++---------- .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 10 ++++++ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 3943121630..90a1c2cb02 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -297,10 +297,9 @@ private Tuple SelectMeshDirectionRotatio if (IsFirstLInConfiguration(neighbours,out first, out second)) { - rotation = TileHelper.AngleBetween(Direction.North, second.Direction); - var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); - var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); - direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); + + direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousDir(direction)); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } @@ -308,28 +307,29 @@ private Tuple SelectMeshDirectionRotatio { // if the second neighbour is on left (the one facing the same direction), then the other // other side of the Lin couch should be linked to it, so we need to do a -90 degree rotation compared to neighbour on right. - rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousCardinalDir(second.Direction)); - var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); - var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); - direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); + + direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousDir(direction)); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } if (IsFirstLOutConfiguration(neighbours, out first, out second)) { - rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetNextCardinalDir(first.Direction)); - var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); - var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); - direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); + + direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + var toRotate = TileHelper.GetOpposite(direction); + toRotate = TileHelper.GetPreviousDir(toRotate); + rotation = TileHelper.AngleBetween(Direction.North, toRotate); + return new Tuple(AdjacencyResolver.lOut, rotation, direction, AdjacencyShape.LOut); } if (IsSecondLOutConfiguration(neighbours, out first, out second)) { - rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetOpposite(second.Direction)); - var firstAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(first.Direction); - var secondAdjacentDirections = TileHelper.GetAdjacentAndMiddleDirection(second.Direction); - direction = firstAdjacentDirections.Intersect(secondAdjacentDirections).First(); + direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + var toRotate = TileHelper.GetOpposite(direction); + toRotate = TileHelper.GetPreviousDir(toRotate); + rotation = TileHelper.AngleBetween(Direction.North, toRotate); return new Tuple(AdjacencyResolver.lOut, rotation, direction, AdjacencyShape.LOut); } @@ -441,7 +441,7 @@ private bool IsFirstLOutConfiguration(List neighbours, out Pla List secondAllowedDirections; // check front and right when this placed object is facing a cardinal direction, - // otherwise check if directionnables are at adjacent directions. + // otherwise check if directionnables are at adjacent directions (the two cardinal adjacent ones). if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) { hasFirstCorrect = HasNeighbourBehind(neighbours, out firstNeighbour); diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index 48f6579ed5..0adae0b604 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -43,6 +43,16 @@ public static Direction GetPreviousCardinalDir(Direction dir) return (Direction) MathUtility.mod((int)dir - 2, 8); } + public static Direction GetPreviousDir(Direction dir) + { + return (Direction)MathUtility.mod((int)dir - 1, 8); + } + + public static Direction GetNextDir(Direction dir) + { + return (Direction)MathUtility.mod((int)dir + 1, 8); + } + /// /// Get the rotation angle of a particular dir. /// E.g. assuming north is the initial position (should be), north return 0, north-east 45 ... From 6812760f69c29bf9e47ae7d27a52b0ee9e0d2219 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 30 Oct 2023 16:40:31 +0100 Subject: [PATCH 47/87] works completely ! --- .../DirectionnalAdjacencyConnector.cs | 33 +++++++++++-------- .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 13 ++++++++ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 90a1c2cb02..4cc50a4e1c 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -345,7 +345,6 @@ private Tuple SelectMeshDirectionRotatio /// private bool IsFirstLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - // Seems to work ! Need to do the same for all L config and I config. bool hasFirstCorrect; bool hasSecondCorrect; List firstAllowedDirections; @@ -374,8 +373,8 @@ private bool IsFirstLInConfiguration(List neighbours, out Plac } else { - firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); - secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + firstAllowedDirections = TileHelper.GetFiveAdjacents(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetFiveAdjacents(secondNeighbour.Direction); } bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); @@ -418,8 +417,8 @@ private bool IsSecondLInConfiguration(List neighbours, out Pla } else { - firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); - secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + firstAllowedDirections = TileHelper.GetFiveAdjacents(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetFiveAdjacents(secondNeighbour.Direction); } bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); @@ -463,8 +462,8 @@ private bool IsFirstLOutConfiguration(List neighbours, out Pla } else { - firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); - secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + firstAllowedDirections = TileHelper.GetFiveAdjacents(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetFiveAdjacents(secondNeighbour.Direction); } bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); @@ -507,8 +506,8 @@ private bool IsSecondLOutConfiguration(List neighbours, out Pl } else { - firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(firstNeighbour.Direction); - secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); + firstAllowedDirections = TileHelper.GetFiveAdjacents(firstNeighbour.Direction); + secondAllowedDirections = TileHelper.GetFiveAdjacents(secondNeighbour.Direction); } bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); @@ -543,6 +542,7 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT Direction original = _placedObject.Direction; bool diagonal = false; List adjacents = TileHelper.GetAdjacentDirections(_placedObject.Direction); + List AllowedDirections; if (!TileHelper.CardinalDirections().Contains(original)) diagonal = true; @@ -556,17 +556,18 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT if (hasNeighbourFirstCardinal) single = firstCardinal; else if (hasNeighbourSecondCardinal) single = secondCardinal; else single = null; + _placedObject.SetDirection(original); + AllowedDirections = TileHelper.GetFiveAdjacents(_placedObject.Direction); + } else { + AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); HasNeighbourOnLeft(neighbours, out single); } - _placedObject.SetDirection(original); - if (single == null) return false; - var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); bool firstCondition = AllowedDirections.Contains(single.Direction); return firstCondition; @@ -583,6 +584,8 @@ private bool IsURightConfiguration(List neighbours, out Placed if (!TileHelper.CardinalDirections().Contains(original)) diagonal = true; + List AllowedDirections; + if (diagonal) { _placedObject.SetDirection(adjacents[0]); @@ -593,17 +596,19 @@ private bool IsURightConfiguration(List neighbours, out Placed if (hasNeighbourFirstCardinal) single = firstCardinal; else if (hasNeighbourSecondCardinal) single = secondCardinal; else single = null; + _placedObject.SetDirection(original); + AllowedDirections = TileHelper.GetFiveAdjacents(_placedObject.Direction); } else { + AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); HasNeighbourOnRight(neighbours, out single); } - _placedObject.SetDirection(original); + if (single == null) return false; - var AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); bool firstCondition = AllowedDirections.Contains(single.Direction); return firstCondition; diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index 0adae0b604..19856a4bcb 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -101,6 +101,19 @@ public static List GetAdjacentAndMiddleDirection(Direction dir) return list; } + /// + /// Return the 5 adjacent directions to Direction dir including itself. + /// + public static List GetFiveAdjacents(Direction dir) + { + return new List{ dir, + (Direction)MathUtility.mod((int)dir + 1, 8), + (Direction)MathUtility.mod((int)dir - 1, 8), + (Direction)MathUtility.mod((int)dir - 2, 8), + (Direction)MathUtility.mod((int)dir +2, 8), + }; + } + /// /// Get the offset in coordinates in a given direction. /// From bea077f28325657afb309dcea061ac7b6c879798 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 30 Oct 2023 21:31:35 +0100 Subject: [PATCH 48/87] everything works for real this time --- .../DirectionnalAdjacencyConnector.cs | 95 ++++++++++++++++--- .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 5 + 2 files changed, 85 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 4cc50a4e1c..861e59cb91 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -297,8 +297,23 @@ private Tuple SelectMeshDirectionRotatio if (IsFirstLInConfiguration(neighbours,out first, out second)) { - - direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + // TODO be careful which diagonal to choose when two adjacent diagonals. It changes for many cases + // and just returning the first one doesn't always work. + if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) + && TileHelper.GetOpposite(first.Direction) != second.Direction + && first.Direction != second.Direction) + { + if (first.GetComponent()._currentShape == AdjacencyShape.LOut) + { + direction = first.Direction; + } + else + { + direction = second.Direction; + } + } + else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousDir(direction)); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } @@ -307,16 +322,41 @@ private Tuple SelectMeshDirectionRotatio { // if the second neighbour is on left (the one facing the same direction), then the other // other side of the Lin couch should be linked to it, so we need to do a -90 degree rotation compared to neighbour on right. - - direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + + if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) + && TileHelper.GetOpposite(first.Direction) != second.Direction + && first.Direction != second.Direction) + { + if (first.GetComponent()._currentShape == AdjacencyShape.LOut) + { + direction = first.Direction; + } + else + { + direction = second.Direction; + } + } + else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousDir(direction)); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } if (IsFirstLOutConfiguration(neighbours, out first, out second)) { - - direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) + && TileHelper.GetOpposite(first.Direction) != second.Direction + && first.Direction != second.Direction) + { + if (first.GetComponent()._currentShape == AdjacencyShape.LIn) + { + direction = first.Direction; + } + else + { + direction = second.Direction; + } + } + else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); var toRotate = TileHelper.GetOpposite(direction); toRotate = TileHelper.GetPreviousDir(toRotate); rotation = TileHelper.AngleBetween(Direction.North, toRotate); @@ -326,7 +366,20 @@ private Tuple SelectMeshDirectionRotatio if (IsSecondLOutConfiguration(neighbours, out first, out second)) { - direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) + && TileHelper.GetOpposite(first.Direction) != second.Direction + && first.Direction != second.Direction) + { + if (first.GetComponent()._currentShape == AdjacencyShape.LIn) + { + direction = first.Direction; + } + else + { + direction = second.Direction; + } + } + else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); var toRotate = TileHelper.GetOpposite(direction); toRotate = TileHelper.GetPreviousDir(toRotate); rotation = TileHelper.AngleBetween(Direction.North, toRotate); @@ -379,7 +432,10 @@ private bool IsFirstLInConfiguration(List neighbours, out Plac bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); - return firstCondition && secondCondition; + bool thirdCondition = !(TileHelper.IsCardinal(firstNeighbour.Direction) + && TileHelper.IsCardinal(secondNeighbour.Direction) + && firstNeighbour.Direction == secondNeighbour.Direction); + return firstCondition && secondCondition && thirdCondition; } /// @@ -423,7 +479,10 @@ private bool IsSecondLInConfiguration(List neighbours, out Pla bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); - return firstCondition && secondCondition; + bool thirdCondition = !(TileHelper.IsCardinal(firstNeighbour.Direction) + && TileHelper.IsCardinal(secondNeighbour.Direction) + && firstNeighbour.Direction == secondNeighbour.Direction); + return firstCondition && secondCondition && thirdCondition; } /// @@ -468,7 +527,10 @@ private bool IsFirstLOutConfiguration(List neighbours, out Pla bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); - return firstCondition && secondCondition; + bool thirdCondition = !(TileHelper.IsCardinal(firstNeighbour.Direction) + && TileHelper.IsCardinal(secondNeighbour.Direction) + && firstNeighbour.Direction == secondNeighbour.Direction); + return firstCondition && secondCondition && thirdCondition; } /// @@ -512,7 +574,10 @@ private bool IsSecondLOutConfiguration(List neighbours, out Pl bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); - return firstCondition && secondCondition; + bool thirdCondition = !(TileHelper.IsCardinal(firstNeighbour.Direction) + && TileHelper.IsCardinal(secondNeighbour.Direction) + && firstNeighbour.Direction == secondNeighbour.Direction); + return firstCondition && secondCondition && thirdCondition; } /// @@ -549,9 +614,9 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT if (diagonal) { _placedObject.SetDirection(adjacents[0]); - bool hasNeighbourFirstCardinal = HasNeighbourOnLeft(neighbours, out var firstCardinal); + bool hasNeighbourFirstCardinal = IsULeftConfiguration(neighbours, out var firstCardinal); _placedObject.SetDirection(adjacents[1]); - bool hasNeighbourSecondCardinal = HasNeighbourOnLeft(neighbours, out var secondCardinal); + bool hasNeighbourSecondCardinal = IsULeftConfiguration(neighbours, out var secondCardinal); if (hasNeighbourFirstCardinal) single = firstCardinal; else if (hasNeighbourSecondCardinal) single = secondCardinal; @@ -589,9 +654,9 @@ private bool IsURightConfiguration(List neighbours, out Placed if (diagonal) { _placedObject.SetDirection(adjacents[0]); - bool hasNeighbourFirstCardinal = HasNeighbourOnRight(neighbours, out var firstCardinal); + bool hasNeighbourFirstCardinal = IsURightConfiguration(neighbours, out var firstCardinal); _placedObject.SetDirection(adjacents[1]); - bool hasNeighbourSecondCardinal = HasNeighbourOnRight(neighbours, out var secondCardinal); + bool hasNeighbourSecondCardinal = IsURightConfiguration(neighbours, out var secondCardinal); if (hasNeighbourFirstCardinal) single = firstCardinal; else if (hasNeighbourSecondCardinal) single = secondCardinal; diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index 19856a4bcb..c82dd2256f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -233,6 +233,11 @@ public static bool IsDiagonal(Direction dir) return DiagonalDirections().Contains(dir); } + public static bool IsCardinal(Direction dir) + { + return CardinalDirections().Contains(dir); + } + /// /// Return the angle between two directions, clock wise is positive. /// From 8d53afdb4209f3ba04df33194bab9566e18a40a7 Mon Sep 17 00:00:00 2001 From: stilnat Date: Tue, 31 Oct 2023 13:32:34 +0100 Subject: [PATCH 49/87] some refactoring and clean up and doc --- .../DirectionnalAdjacencyConnector.cs | 388 +++++++----------- .../Tile/PlacedObjects/PlacedTileObject.cs | 59 +++ 2 files changed, 209 insertions(+), 238 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 861e59cb91..191636e7a3 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -151,9 +151,6 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) bool updated = UpdateMeshRotationDirection(results.Item1, results.Item2, results.Item3, results.Item4, connections); - - // update all neighbours the first time, then update only neighbours if this is updated. - // TODO update only the connected ones ? if (updated || updateNeighbour) { foreach(var adjacent in neighbours) @@ -163,7 +160,17 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) } } - private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, Direction direction, AdjacencyShape shape, int connectionNumbers) + /// + /// Update everything regarding this directionnal. + /// + /// The new mesh to apply to this directionnal + /// The new rotation to apply to this directionnal + /// The new direction to apply to this directionnal + /// The new shape to apply to this directionnal + /// The new number of connections to apply to this directionnal + /// true if anything changed compared to before. + private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, + Direction direction, AdjacencyShape shape, int connectionNumbers) { bool updated = direction != _placedObject.Direction; updated |= rotation != _currentRotation; @@ -173,11 +180,8 @@ private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, Direction di _currentShape = shape; _currentRotation = rotation; _currentConnections = connectionNumbers; - - _placedObject.SetDirection(direction); _filter.mesh = mesh; - Quaternion localRotation = transform.localRotation; Vector3 eulerRotation = localRotation.eulerAngles; localRotation = Quaternion.Euler(eulerRotation.x, rotation, eulerRotation.z); @@ -186,18 +190,45 @@ private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, Direction di return updated; } - private bool HasSingleConnection(List neighbours ,out PlacedTileObject neighbour) + /// + /// check if the directionnal has two connections. Single connections for + /// directionnals means they are in a particular configuration relative + /// to their neighbours. They are in a U configuration. It's also important to note that + /// directionnals with two connections are not considered to have one connection, they + /// are mutually exclusive. + /// + /// a list of other directionnals, adjacent to this one, + /// which are not fully connected yet. + /// The single connection if it exists + /// true if it has one and only one connection with a neighbour. + private bool HasSingleConnection(List neighbours, + out PlacedTileObject neighbour) { neighbour = null; // has double connection, therefore not a single one. - if(HasDoubleConnection(neighbours, out var first, out var second)) return false; + if (HasDoubleConnection(neighbours, out PlacedTileObject first, + out PlacedTileObject second)) + { + return false; + } - return IsULeftConfiguration(neighbours, out neighbour) - || IsURightConfiguration(neighbours, out neighbour); + return IsUConfiguration(neighbours, out neighbour, true) + || IsUConfiguration(neighbours, out neighbour, false); } - private bool HasDoubleConnection(List neighbours, out PlacedTileObject first, out PlacedTileObject second) + /// + /// check if the directionnal has two connections. Double connections for + /// directionnals means they are in a particular configuration relative + /// to their neighbours. + /// + /// a list of other directionnals, adjacent to this one, + /// which are not fully connected yet. + /// The first connection if it exists + /// The second connection if it exists + /// true if this has two connections with adjacent neighbours. + private bool HasDoubleConnection(List neighbours, + out PlacedTileObject first, out PlacedTileObject second) { return IsIConfiguration(neighbours, out first, out second) || IsFirstLInConfiguration(neighbours, out first, out second) @@ -207,7 +238,10 @@ private bool HasDoubleConnection(List neighbours, out PlacedTi } - + /// + /// Get all neighbour directionnal, in cardinal directions from this. + /// + /// a list of found neighbours. private List GetNeighbourDirectionnal() { var tileSystem = Subsystems.Get(); @@ -218,6 +252,13 @@ private List GetNeighbourDirectionnal() x.TryGetComponent(out var component)).ToList(); } + /// + /// Given a particular configuration of neighbours with a single connection, + /// give all necessary informations on how this directionnal should be. + /// + /// A list of other directionnals, adjacent to this one, + /// which are not fully connected yet. + /// All necessary data to update this private Tuple SelectMeshDirectionRotationSingleConnection(List neighbours) { float rotation; @@ -225,12 +266,12 @@ private Tuple SelectMeshDirectionRotationS AdjacencyShape shape; Mesh mesh; - if (IsULeftConfiguration(neighbours, out var single)) + if (IsUConfiguration(neighbours, out var single, true)) { shape = AdjacencyShape.ULeft; mesh = AdjacencyResolver.uLeft; } - else if (IsURightConfiguration(neighbours, out single)) + else if (IsUConfiguration(neighbours, out single, false)) { shape = AdjacencyShape.URight; mesh = AdjacencyResolver.uRight; @@ -253,19 +294,19 @@ private Tuple SelectMeshDirectionRotationS if(shape == AdjacencyShape.ULeft) { _placedObject.SetDirection(adjacents[0]); - if (IsULeftConfiguration(neighbours, out var temp) && temp == single) + if (IsUConfiguration(neighbours, out var temp, true) && temp == single) direction = adjacents[0]; _placedObject.SetDirection(adjacents[1]); - if (IsULeftConfiguration(neighbours, out temp) && temp == single) + if (IsUConfiguration(neighbours, out temp, true) && temp == single) direction = adjacents[1]; } else if (shape == AdjacencyShape.URight) { _placedObject.SetDirection(adjacents[0]); - if (IsURightConfiguration(neighbours, out var temp) && temp == single) + if (IsUConfiguration(neighbours, out var temp, false) && temp == single) direction = adjacents[0]; _placedObject.SetDirection(adjacents[1]); - if (IsURightConfiguration(neighbours, out temp) && temp == single) + if (IsUConfiguration(neighbours, out temp, false) && temp == single) direction = adjacents[1]; } } @@ -280,9 +321,12 @@ private Tuple SelectMeshDirectionRotationS } /// - /// In case a neighbour is in front or behind of this placed object, it should be the first neighbour parameter. - /// no object should be null. + /// Given a particular configuration of neighbours with a double connection, + /// give all necessary informations on how this directionnal should be. /// + /// A list of other directionnals, adjacent to this one, + /// which are not fully connected yet. + /// All necessary data to update this private Tuple SelectMeshDirectionRotationDoubleConnection(List neighbours) { float rotation; @@ -297,66 +341,21 @@ private Tuple SelectMeshDirectionRotatio if (IsFirstLInConfiguration(neighbours,out first, out second)) { - // TODO be careful which diagonal to choose when two adjacent diagonals. It changes for many cases - // and just returning the first one doesn't always work. - if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) - && TileHelper.GetOpposite(first.Direction) != second.Direction - && first.Direction != second.Direction) - { - if (first.GetComponent()._currentShape == AdjacencyShape.LOut) - { - direction = first.Direction; - } - else - { - direction = second.Direction; - } - } - else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); - + direction = DirectionInLConfiguration(first, second, true); rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousDir(direction)); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } if (IsSecondLInConfiguration(neighbours, out first, out second)) { - // if the second neighbour is on left (the one facing the same direction), then the other - // other side of the Lin couch should be linked to it, so we need to do a -90 degree rotation compared to neighbour on right. - - if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) - && TileHelper.GetOpposite(first.Direction) != second.Direction - && first.Direction != second.Direction) - { - if (first.GetComponent()._currentShape == AdjacencyShape.LOut) - { - direction = first.Direction; - } - else - { - direction = second.Direction; - } - } - else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + direction = DirectionInLConfiguration(first, second, true); rotation = TileHelper.AngleBetween(Direction.North, TileHelper.GetPreviousDir(direction)); return new Tuple(AdjacencyResolver.lIn, rotation, direction, AdjacencyShape.LIn); } if (IsFirstLOutConfiguration(neighbours, out first, out second)) { - if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) - && TileHelper.GetOpposite(first.Direction) != second.Direction - && first.Direction != second.Direction) - { - if (first.GetComponent()._currentShape == AdjacencyShape.LIn) - { - direction = first.Direction; - } - else - { - direction = second.Direction; - } - } - else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + direction = DirectionInLConfiguration(first, second, false); var toRotate = TileHelper.GetOpposite(direction); toRotate = TileHelper.GetPreviousDir(toRotate); rotation = TileHelper.AngleBetween(Direction.North, toRotate); @@ -366,20 +365,7 @@ private Tuple SelectMeshDirectionRotatio if (IsSecondLOutConfiguration(neighbours, out first, out second)) { - if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) - && TileHelper.GetOpposite(first.Direction) != second.Direction - && first.Direction != second.Direction) - { - if (first.GetComponent()._currentShape == AdjacencyShape.LIn) - { - direction = first.Direction; - } - else - { - direction = second.Direction; - } - } - else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + direction = DirectionInLConfiguration(first, second, false); var toRotate = TileHelper.GetOpposite(direction); toRotate = TileHelper.GetPreviousDir(toRotate); rotation = TileHelper.AngleBetween(Direction.North, toRotate); @@ -392,9 +378,11 @@ private Tuple SelectMeshDirectionRotatio } /// - /// (in case of this placed object turned toward north) - /// FirstLIn is when a neighbour is in front, looking toward east, and another neighbour on the right, - /// looking toward north as well. + /// (in case of this placed object turned toward north or north-east) + /// FirstLIn is when a neighbour is in front, + /// looking toward east, south-east or north-east and another neighbour on the right, + /// looking toward north, north-east or north-west. + /// This method checks that neighbours are respecting those different possibilities. /// private bool IsFirstLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { @@ -404,22 +392,26 @@ private bool IsFirstLInConfiguration(List neighbours, out Plac List secondAllowedDirections; // check front and right when this placed object is facing a cardinal direction, - // otherwise check if directionnables are at adjacent directions. + // otherwise check if directionnables are at adjacent directions from the direction + // this is looking at. + // e.g : if this is looking at north east, check if neighbours are at north and east. if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) { - hasFirstCorrect = HasNeighbourInFront(neighbours, out firstNeighbour); - hasSecondCorrect = HasNeighbourOnRight(neighbours, out secondNeighbour); + hasFirstCorrect = _placedObject.HasNeighbourFrontBack(neighbours, out firstNeighbour, true); + hasSecondCorrect = _placedObject.HasNeighbourOnSide(neighbours, out secondNeighbour, false); } else { var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); - hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, directions[1]); - hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, directions[0]); + hasFirstCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out firstNeighbour, directions[1]); + hasSecondCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out secondNeighbour, directions[0]); } + // If the neighbours are not at the right places return false. if (!(hasFirstCorrect && hasSecondCorrect)) return false; - if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) + // This check for neighbours right directions. A range of directions + if (TileHelper.IsCardinal(_placedObject.Direction)) { firstAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(TileHelper.GetPreviousCardinalDir(firstNeighbour.Direction)); secondAllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(secondNeighbour.Direction); @@ -454,14 +446,14 @@ private bool IsSecondLInConfiguration(List neighbours, out Pla // otherwise check if directionnables are at adjacent directions. if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) { - hasFirstCorrect = HasNeighbourInFront(neighbours, out firstNeighbour); - hasSecondCorrect = HasNeighbourOnLeft(neighbours, out secondNeighbour); + hasFirstCorrect = _placedObject.HasNeighbourFrontBack(neighbours, out firstNeighbour, true); + hasSecondCorrect = _placedObject.HasNeighbourOnSide(neighbours, out secondNeighbour, true); } else { var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); - hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, directions[1]); - hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, directions[0]); + hasFirstCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out firstNeighbour, directions[1]); + hasSecondCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out secondNeighbour, directions[0]); } if (!(hasFirstCorrect && hasSecondCorrect)) return false; @@ -480,8 +472,8 @@ private bool IsSecondLInConfiguration(List neighbours, out Pla bool firstCondition = firstAllowedDirections.Contains(_placedObject.Direction); bool secondCondition = secondAllowedDirections.Contains(_placedObject.Direction); bool thirdCondition = !(TileHelper.IsCardinal(firstNeighbour.Direction) - && TileHelper.IsCardinal(secondNeighbour.Direction) - && firstNeighbour.Direction == secondNeighbour.Direction); + && TileHelper.IsCardinal(secondNeighbour.Direction) + && firstNeighbour.Direction == secondNeighbour.Direction); return firstCondition && secondCondition && thirdCondition; } @@ -502,14 +494,14 @@ private bool IsFirstLOutConfiguration(List neighbours, out Pla // otherwise check if directionnables are at adjacent directions (the two cardinal adjacent ones). if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) { - hasFirstCorrect = HasNeighbourBehind(neighbours, out firstNeighbour); - hasSecondCorrect = HasNeighbourOnRight(neighbours, out secondNeighbour); + hasFirstCorrect = _placedObject.HasNeighbourFrontBack(neighbours, out firstNeighbour, false); + hasSecondCorrect = _placedObject.HasNeighbourOnSide(neighbours, out secondNeighbour, false); } else { var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); - hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, TileHelper.GetOpposite(directions[1])); - hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, TileHelper.GetOpposite(directions[0])); + hasFirstCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out firstNeighbour, TileHelper.GetOpposite(directions[1])); + hasSecondCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out secondNeighbour, TileHelper.GetOpposite(directions[0])); } if (!(hasFirstCorrect && hasSecondCorrect)) return false; @@ -549,14 +541,14 @@ private bool IsSecondLOutConfiguration(List neighbours, out Pl // otherwise check if directionnables are at adjacent directions. if (TileHelper.CardinalDirections().Contains(_placedObject.Direction)) { - hasFirstCorrect = HasNeighbourBehind(neighbours, out firstNeighbour); - hasSecondCorrect = HasNeighbourOnLeft(neighbours, out secondNeighbour); + hasFirstCorrect = _placedObject.HasNeighbourFrontBack(neighbours, out firstNeighbour, false); + hasSecondCorrect = _placedObject.HasNeighbourOnSide(neighbours, out secondNeighbour, true); } else { var directions = TileHelper.GetAdjacentDirections(_placedObject.Direction); - hasFirstCorrect = HasNeighbourAtDirection(neighbours, out firstNeighbour, TileHelper.GetOpposite(directions[1])); - hasSecondCorrect = HasNeighbourAtDirection(neighbours, out secondNeighbour, TileHelper.GetOpposite(directions[0])); + hasFirstCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out firstNeighbour, TileHelper.GetOpposite(directions[1])); + hasSecondCorrect = _placedObject.HasNeighbourAtDirection(neighbours, out secondNeighbour, TileHelper.GetOpposite(directions[0])); } if (!(hasFirstCorrect && hasSecondCorrect)) return false; @@ -585,8 +577,8 @@ private bool IsSecondLOutConfiguration(List neighbours, out Pl /// private bool IsIConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { - bool hasLeft = HasNeighbourOnLeft(neighbours, out firstNeighbour); - bool hasRight = HasNeighbourOnRight(neighbours, out secondNeighbour); + bool hasLeft = _placedObject.HasNeighbourOnSide(neighbours, out firstNeighbour, true); + bool hasRight = _placedObject.HasNeighbourOnSide(neighbours, out secondNeighbour, false); if (!(hasLeft && hasRight)) return false; @@ -602,7 +594,8 @@ private bool IsIConfiguration(List neighbours, out PlacedTileO /// /// Neighbour is on left and looking in the same direction, it's a connection (Ushape) /// - private bool IsULeftConfiguration(List neighbours, out PlacedTileObject single) + private bool IsUConfiguration(List neighbours, + out PlacedTileObject single, bool left) { Direction original = _placedObject.Direction; bool diagonal = false; @@ -614,9 +607,11 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT if (diagonal) { _placedObject.SetDirection(adjacents[0]); - bool hasNeighbourFirstCardinal = IsULeftConfiguration(neighbours, out var firstCardinal); + bool hasNeighbourFirstCardinal = + IsUConfiguration(neighbours, out var firstCardinal, left); _placedObject.SetDirection(adjacents[1]); - bool hasNeighbourSecondCardinal = IsULeftConfiguration(neighbours, out var secondCardinal); + bool hasNeighbourSecondCardinal = + IsUConfiguration(neighbours, out var secondCardinal, left); if (hasNeighbourFirstCardinal) single = firstCardinal; else if (hasNeighbourSecondCardinal) single = secondCardinal; @@ -628,130 +623,11 @@ private bool IsULeftConfiguration(List neighbours, out PlacedT else { AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); - HasNeighbourOnLeft(neighbours, out single); + _placedObject.HasNeighbourOnSide(neighbours, out single, left); } if (single == null) return false; - - bool firstCondition = AllowedDirections.Contains(single.Direction); - - return firstCondition; - } - - /// - /// Neighbour is on right and looking in the same direction, it's a connection (Ushape) - /// - private bool IsURightConfiguration(List neighbours, out PlacedTileObject single) - { - Direction original = _placedObject.Direction; - bool diagonal = false; - List adjacents = TileHelper.GetAdjacentDirections(_placedObject.Direction); - - if (!TileHelper.CardinalDirections().Contains(original)) diagonal = true; - - List AllowedDirections; - - if (diagonal) - { - _placedObject.SetDirection(adjacents[0]); - bool hasNeighbourFirstCardinal = IsURightConfiguration(neighbours, out var firstCardinal); - _placedObject.SetDirection(adjacents[1]); - bool hasNeighbourSecondCardinal = IsURightConfiguration(neighbours, out var secondCardinal); - - if (hasNeighbourFirstCardinal) single = firstCardinal; - else if (hasNeighbourSecondCardinal) single = secondCardinal; - else single = null; - _placedObject.SetDirection(original); - AllowedDirections = TileHelper.GetFiveAdjacents(_placedObject.Direction); - } - else - { - AllowedDirections = TileHelper.GetAdjacentAndMiddleDirection(_placedObject.Direction); - HasNeighbourOnRight(neighbours, out single); - } - - - - if (single == null) return false; - - bool firstCondition = AllowedDirections.Contains(single.Direction); - - return firstCondition; - } - - private bool HasNeighbourBehind(List neighbours, out PlacedTileObject behind) - { - foreach (var neighbour in neighbours) - { - if (neighbour.IsBehind(_placedObject)) - { - behind = neighbour; - return true; - } - } - - behind = null; - return false; - } - - private bool HasNeighbourInFront(List neighbours, out PlacedTileObject inFront) - { - foreach (var neighbour in neighbours) - { - if (neighbour.IsInFront(_placedObject)) - { - inFront = neighbour; - return true; - } - } - - inFront = null; - return false; - } - - private bool HasNeighbourOnRight(List neighbours, out PlacedTileObject onRight) - { - foreach (var neighbour in neighbours) - { - if (neighbour.IsOnRight(_placedObject)) - { - onRight = neighbour; - return true; - } - } - - onRight = null; - return false; - } - - private bool HasNeighbourOnLeft(List neighbours, out PlacedTileObject onLeft) - { - foreach (var neighbour in neighbours) - { - if (neighbour.IsOnLeft(_placedObject)) - { - onLeft = neighbour; - return true; - } - } - - onLeft = null; - return false; - } - - private bool HasNeighbourAtDirection(List neighbours, out PlacedTileObject atDirection, Direction dir) - { - foreach (var neighbour in neighbours) - { - if (_placedObject.AtDirectionOf(neighbour, dir)) - { - atDirection = neighbour; - return true; - } - } - - atDirection = null; - return false; + return AllowedDirections.Contains(single.Direction); } private bool DirectionnalAlreadyHasTwoConnections(PlacedTileObject directionnal, bool excludingThis) @@ -771,13 +647,49 @@ private bool DirectionnalAlreadyHasTwoConnections(PlacedTileObject directionnal, return false; } - private bool DirectionnalHasSingleConnection(PlacedTileObject directionnal, out PlacedTileObject first, - bool excludingThis) + /// + /// In L configuration, the direction of the middle directionnal depends on the direction + /// of its two neighbours. There is nine possible L configuration, for both first + /// and second LIn and LOut. It's better to draw them to understand properly. On those nine + /// configurations, 5 of them contain a neighbour with a single diagonal direction. + /// The direction of this directional is then simply the closest diagonal from both directions + /// of neighbours. + /// e.g : neighbour 1 looks toward west, neighbour 2 looks toward north, this looks toward + /// northwest. + /// eg : neighbour 1 looks toward northwest, neighbour 2 looks toward north, this looks + /// toward northwest. + /// When the two neighbours looks into diagonal directions, it's a bit different. + /// When the two diagonals are opposite, it's also the closest diagonal. + /// When the two diagonals are the same, it's also the closest diagonal. + /// Two cases are special, when neighbours diagonal directions are adjacent. + /// In this case, the middle directionnal should take the direction of the neighbour + /// in a LOut shape, if the middle is LIn, and the neighbour in a LIn shape, if the middle + /// is LOut. + /// + /// first neighbour part of the LIn configuration. + /// second neighbour part of the LIn configuration. + /// if the middle (this) is in LIn configuration. + /// the good direction for the middle directionnal. + private Direction DirectionInLConfiguration(PlacedTileObject first, PlacedTileObject second, bool LIn) { - var directionnalConnector = directionnal.GetComponent(); - var directionnalNeighbours = directionnalConnector.GetNeighbourDirectionnal(); - if(excludingThis) directionnalNeighbours.Remove(_placedObject); - return directionnalConnector.HasSingleConnection(directionnalNeighbours, out first); + Direction direction; + AdjacencyShape shapeToCheck = LIn ? AdjacencyShape.LOut : AdjacencyShape.LIn; + if (TileHelper.IsDiagonal(first.Direction) && TileHelper.IsDiagonal(second.Direction) + && TileHelper.GetOpposite(first.Direction) != second.Direction + && first.Direction != second.Direction) + { + if (first.GetComponent()._currentShape == shapeToCheck) + { + direction = first.Direction; + } + else + { + direction = second.Direction; + } + } + else direction = TileHelper.ClosestDiagonalFromTwo(first.Direction, second.Direction); + + return direction; } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 61cfc312bd..968fd2d052 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -206,5 +206,64 @@ public bool AtDirectionOf(PlacedTileObject other, Direction dir) } } + + public bool HasNeighbourFrontBack(List neighbours, + out PlacedTileObject inFrontOrBack, bool front) + { + foreach (var neighbour in neighbours) + { + if (front && neighbour.IsInFront(this)) + { + inFrontOrBack = neighbour; + return true; + } + + if (!front && neighbour.IsBehind(this)) + { + inFrontOrBack = neighbour; + return true; + } + } + + inFrontOrBack = null; + return false; + } + + public bool HasNeighbourOnSide(List neighbours, + out PlacedTileObject onSide, bool left) + { + foreach (var neighbour in neighbours) + { + if (!left && neighbour.IsOnRight(this)) + { + onSide = neighbour; + return true; + } + + if (left && neighbour.IsOnLeft(this)) + { + onSide = neighbour; + return true; + } + } + + onSide = null; + return false; + } + + public bool HasNeighbourAtDirection(List neighbours, out PlacedTileObject atDirection, Direction dir) + { + foreach (var neighbour in neighbours) + { + if (AtDirectionOf(neighbour, dir)) + { + atDirection = neighbour; + return true; + } + } + + atDirection = null; + return false; + } } } \ No newline at end of file From d32abc407f88d2870db8848f86ad7316abe81558 Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 12:19:36 +0100 Subject: [PATCH 50/87] add disposal furniture connector --- .../Connections/DisposalFurnitureConnector.cs | 79 +++++++++++++++++++ .../DisposalFurnitureConnector.cs.meta | 11 +++ .../DisposalPipeAdjacencyConnector.cs | 2 + 3 files changed, 92 insertions(+) create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs create mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs.meta diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs new file mode 100644 index 0000000000..06e0056c96 --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs @@ -0,0 +1,79 @@ +using FishNet.Object.Synchronizing; +using SS3D.Core; +using SS3D.Core.Behaviours; +using SS3D.Interactions.Interfaces; +using SS3D.Logging; +using SS3D.Systems.Furniture; +using SS3D.Systems.Tile.Connections; +using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace SS3D.Systems.Tile.Connections +{ + public class DisposalFurnitureConnector : NetworkActor, IAdjacencyConnector + { + private PlacedTileObject _placedObject; + + private bool _connectedToPipe; + + private void Setup() + { + _placedObject = GetComponent(); + } + + public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + { + if(neighbourObject == null) return false; + + if (!neighbourObject.TryGetComponent(out var pipeConnector)) + return false; + + Vector2Int neighbourPosition = neighbourObject.Origin; + + if(neighbourPosition != _placedObject.Origin) return false; + + if (pipeConnector.HorizontalConnectionCount >= 2) return false; + + return true; + } + + public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + { + // update pipe just below. + Setup(); + + if(TryGetPipeBelow(out PlacedTileObject pipe)) + { + UpdateSingleConnection(Direction.North, pipe, true); + }; + } + + public bool UpdateSingleConnection(Direction direction, PlacedTileObject neighbourObject, bool updateNeighbour) + { + Setup(); + + bool isConnected = IsConnected(direction, neighbourObject); + bool updated = _connectedToPipe != isConnected; + + // Update our neighbour as well + if (isConnected && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(_placedObject, direction); + + return updated; + } + + private bool TryGetPipeBelow(out PlacedTileObject pipe) + { + TileSystem tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + + TileChunk currentChunk = map.GetChunk(_placedObject.gameObject.transform.position); + var pipeLocation = currentChunk.GetTileObject(TileLayer.Disposal, _placedObject.Origin.x, _placedObject.Origin.y); + pipe = pipeLocation.PlacedObject; + + return pipe != null; + } + } +} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs.meta new file mode 100644 index 0000000000..4857a3574f --- /dev/null +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c8b1a8e25f9a0442a328450c55e1dcd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 8333c703e7..3cb3d9189b 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -37,6 +37,8 @@ public class DisposalPipeAdjacencyConnector : NetworkActor, IAdjacencyConnector private bool _isVertical = false; + public int HorizontalConnectionCount => _adjacencyMap.CardinalConnectionCount; + private void Setup() { From 06b870861af9adb84b6c7dbe2da41dade27c3494 Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 15:17:29 +0100 Subject: [PATCH 51/87] little stuff for adjacencymap --- Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs index 8db9107184..ed955a6e3c 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyMap.cs @@ -25,6 +25,11 @@ public class AdjacencyMap /// public int DiagonalConnectionCount => GetAdjacencies(false).Count; + /// + /// Get the total number of connections. + /// + public int ConnectionCount => GetAdjacencies(true).Count + GetAdjacencies(false).Count; + public AdjacencyMap() { _connections = new [] { From 9422baa0a7f84402747102aec7b398f0c25830ed Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 15:17:58 +0100 Subject: [PATCH 52/87] method for PlacedTileObject --- .../Tile/PlacedObjects/PlacedTileObject.cs | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 9a05ee2732..4f598f132a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -107,7 +107,7 @@ public void UpdateAdjacencies(PlacedTileObject[] neighbourObjects) _connector.UpdateAllConnections(neighbourObjects); } - public void UpdateSingleAdjacency(PlacedTileObject neighbourObject, Direction dir) + public void UpdateSingleAdjacency(Direction dir, PlacedTileObject neighbourObject) { if (HasAdjacencyConnector) _connector.UpdateSingleConnection(dir, neighbourObject, false); @@ -185,5 +185,38 @@ public bool IsOnLeft(PlacedTileObject other) return false; } + + /// + /// Other is a neighbour, placed at some direction from this. + /// + /// another placedTileObject, which should be neighbouring this. + /// the found direction, north by default + /// true if other is a neighbour of this in term of coordinates + public bool NeighbourAtDirectionOf(PlacedTileObject other, out Direction direction) + { + direction = Direction.North; + if (other == null) return false; + Vector2Int coordinateDifference = other.Origin - Origin; + + if(coordinateDifference == Vector2Int.up) + direction = Direction.North; + else if(coordinateDifference == Vector2Int.down) + direction = Direction.South; + else if (coordinateDifference == Vector2Int.left) + direction = Direction.West; + else if (coordinateDifference == Vector2Int.right) + direction = Direction.East; + else if (coordinateDifference == Vector2Int.up + Vector2Int.right) + direction = Direction.NorthEast; + else if (coordinateDifference == Vector2Int.up + Vector2Int.left) + direction = Direction.NorthWest; + else if (coordinateDifference == Vector2Int.down + Vector2Int.left) + direction = Direction.SouthWest; + else if (coordinateDifference == Vector2Int.down + Vector2Int.right) + direction = Direction.SouthEast; + else return false; + + return true; + } } } \ No newline at end of file From 0c788c989f9a4816d34c9c7ab2e0803e2234c1bf Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 15:18:36 +0100 Subject: [PATCH 53/87] updating IAdjacencyConnector and all that depends on it --- .../AbstractHorizontalConnector.cs | 18 ++++-- .../Connections/AdvancedAdjacencyConnector.cs | 2 +- .../Connections/DisposalFurnitureConnector.cs | 15 +++-- .../DisposalPipeAdjacencyConnector.cs | 63 ++++++++++++++----- .../Connections/DoorAdjacencyConnector.cs | 6 +- .../Tile/Connections/IAdjacencyConnector.cs | 10 ++- .../Connections/MultiAdjacencyConnector.cs | 13 +++- .../Connections/PipeAdjacencyConnector.cs | 2 +- .../Connections/SimpleAdjacencyConnector.cs | 2 +- .../Connections/WallAdjacencyConnector.cs | 2 +- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 31 ++++++--- 11 files changed, 122 insertions(+), 42 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index cac863eca1..a2053902b2 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -1,11 +1,13 @@ using FishNet.Object.Synchronizing; using JetBrains.Annotations; using SS3D.Attributes; +using SS3D.Core; using SS3D.Core.Behaviours; using SS3D.Logging; using SS3D.Systems.Tile.Connections.AdjacencyTypes; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace SS3D.Systems.Tile.Connections @@ -44,7 +46,7 @@ public abstract class AbstractHorizontalConnector : NetworkActor, IAdjacencyConn /// /// Abstract method, as from one connector to another, the code to check for connection greatly changes. /// - public abstract bool IsConnected(Direction dir, PlacedTileObject neighbourObject); + public abstract bool IsConnected(PlacedTileObject neighbourObject); public override void OnStartClient() @@ -89,7 +91,7 @@ public virtual void UpdateAllConnections(PlacedTileObject[] neighbourObjects) bool changed = false; for (int i = 0; i < neighbourObjects.Length; i++) { - changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); + changed |= UpdateSingleConnection((Direction) i, neighbourObjects[i], true); } if (changed) @@ -105,11 +107,12 @@ public virtual bool UpdateSingleConnection(Direction dir, PlacedTileObject neigh { Setup(); - bool isConnected = IsConnected(dir, neighbourObject); + bool isConnected = IsConnected(neighbourObject); + // Update our neighbour as well if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); @@ -169,5 +172,12 @@ public void SetBlockedDirection(Direction dir, bool value) _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); UpdateMeshAndDirection(); } + + public List GetNeighbours() + { + TileSystem tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + return map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position).ToList(); + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs index ef460bf7b5..47e203a54e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdvancedAdjacencyConnector.cs @@ -17,7 +17,7 @@ public class AdvancedAdjacencyConnector : AbstractHorizontalConnector, IAdjacenc [SerializeField] private AdvancedConnector advancedAdjacency; protected override IMeshAndDirectionResolver AdjacencyResolver => advancedAdjacency; - public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(PlacedTileObject neighbourObject) { bool isConnected = false; if (neighbourObject) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs index 06e0056c96..53e24b64c8 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs @@ -23,7 +23,7 @@ private void Setup() _placedObject = GetComponent(); } - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public bool IsConnected(PlacedTileObject neighbourObject) { if(neighbourObject == null) return false; @@ -50,16 +50,16 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) }; } - public bool UpdateSingleConnection(Direction direction, PlacedTileObject neighbourObject, bool updateNeighbour) + public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { Setup(); - bool isConnected = IsConnected(direction, neighbourObject); + bool isConnected = IsConnected(neighbourObject); bool updated = _connectedToPipe != isConnected; // Update our neighbour as well if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, direction); + neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); return updated; } @@ -75,5 +75,12 @@ private bool TryGetPipeBelow(out PlacedTileObject pipe) return pipe != null; } + + public List GetNeighbours() + { + bool hasNeighbour = TryGetPipeBelow(out PlacedTileObject pipe); + if (hasNeighbour) return new List { pipe }; + else return new List(); + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 3cb3d9189b..176cb44477 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -8,6 +8,7 @@ using SS3D.Systems.Tile.Connections.AdjacencyTypes; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace SS3D.Systems.Tile.Connections @@ -60,7 +61,7 @@ private void Setup() } } - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public bool IsConnected(PlacedTileObject neighbourObject) { if (neighbourObject == null) return false; @@ -100,15 +101,12 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje { Setup(); - bool isConnected = IsConnected(dir, neighbourObject); + bool isConnected = IsConnected(neighbourObject); - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); - - bool isUpdated; + bool isUpdated = false; bool isVertical; + if(neighbourObject != null) { if (neighbourObject.GetComponent() != null) @@ -134,15 +132,36 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje UpdateMeshAndDirection(); } + // Update our neighbour as well + if (isUpdated && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); + return isUpdated; } - - - isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - if (isUpdated) + else { - UpdateMeshAndDirection(); + // the disposal above gets removed + if(!TryGetDisposalElementAbovePipe(out var disposalFurniture) && _verticalConnection == true) + { + _verticalConnection = false; + isUpdated = true; + } + // another pipe get removed + else + { + isUpdated = _adjacencyMap.SetConnection(dir, + new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + } + + if (isUpdated) + { + UpdateMeshAndDirection(); + } } + + // Update our neighbour as well + if (isUpdated && updateNeighbour) + neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); return isUpdated; } @@ -156,13 +175,13 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) bool changed = false; for (int i = 0; i < neighbourObjects.Length; i++) { - changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); + changed |= UpdateSingleConnection((Direction) i,neighbourObjects[i], true); } if(TryGetDisposalElementAbovePipe(out IDisposalElement disposalElement)) { var placedDisposal = disposalElement.GameObject.GetComponent(); - changed |= UpdateSingleConnection(0, placedDisposal, false); + changed |= UpdateSingleConnection(Direction.North, placedDisposal, false) ; } if (changed) @@ -252,5 +271,21 @@ private void SetBlockedDirection(List directions, bool value) UpdateMeshAndDirection(); } + + public List GetNeighbours() + { + PlacedTileObject placedDisposal = null; + List neighbours; + if (TryGetDisposalElementAbovePipe(out IDisposalElement disposalElement)) + { + placedDisposal = disposalElement.GameObject.GetComponent(); + } + TileSystem tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + neighbours = map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position).ToList(); + if(placedDisposal != null) + neighbours.Add(placedDisposal); + return neighbours; + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index 6fcb700b03..5961c85588 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -35,9 +35,9 @@ private enum DoorType // WallCap gameobjects, North, East, South, West. Null if not present. private GameObject[] wallCaps = new GameObject[4]; - public override bool UpdateSingleConnection(Direction direction, PlacedTileObject placedObject, bool updateNeighbours) + public override bool UpdateSingleConnection(Direction dir, PlacedTileObject placedObject, bool updateNeighbours) { - bool update = base.UpdateSingleConnection(direction, placedObject, updateNeighbours); + bool update = base.UpdateSingleConnection(dir, placedObject, updateNeighbours); if (update) UpdateWallCaps(); return update; @@ -100,7 +100,7 @@ private GameObject SpawnWallCap(Direction direction) return wallCap; } - public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(PlacedTileObject neighbourObject) { return (neighbourObject && neighbourObject.HasAdjacencyConnector && neighbourObject.GenericType == TileObjectGenericType.Wall); diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs index 2e98df709e..ef5ab87585 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs @@ -1,12 +1,16 @@ -namespace SS3D.Systems.Tile.Connections +using System.Collections.Generic; + +namespace SS3D.Systems.Tile.Connections { /// /// Interface that all adjacency connectors should use. /// + /// TODO : add getneighbours method, remove neighbour parameters. public interface IAdjacencyConnector { - bool UpdateSingleConnection(Direction direction, PlacedTileObject neighbourObject, bool updateNeighbour); + bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour); void UpdateAllConnections(PlacedTileObject[] neighbourObjects); - bool IsConnected(Direction dir, PlacedTileObject neighbourObject); + bool IsConnected(PlacedTileObject neighbourObject); + List GetNeighbours(); } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs index ec62bafa42..3f10e5781d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs @@ -1,9 +1,11 @@ using FishNet.Object; using FishNet.Object.Synchronizing; +using SS3D.Core; using SS3D.Logging; using SS3D.Systems.Tile.Connections.AdjacencyTypes; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; using UnityEngine.Serialization; @@ -86,7 +88,7 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje // Update our neighbour as well if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(_placedObject, TileHelper.GetOpposite(dir)); + neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); } isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); @@ -156,9 +158,16 @@ private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) } } - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public bool IsConnected(PlacedTileObject neighbourObject) { throw new System.NotImplementedException(); } + + public List GetNeighbours() + { + TileSystem tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + return map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position).ToList(); + } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs index 9e742f59dd..05ea05e557 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs @@ -12,7 +12,7 @@ public class PipeAdjacencyConnector : AbstractHorizontalConnector private OffsetConnector _connector; protected override IMeshAndDirectionResolver AdjacencyResolver => _connector; - public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(PlacedTileObject neighbourObject) { bool isConnected = false; if (neighbourObject != null) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs index f9a79d8548..42f73422ca 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs @@ -18,7 +18,7 @@ public class SimpleAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyC [SerializeField] private SimpleConnector simpleAdjacency; protected override IMeshAndDirectionResolver AdjacencyResolver => simpleAdjacency; - public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(PlacedTileObject neighbourObject) { bool isConnected = false; if (neighbourObject != null) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs index f7bfee79b7..6687009f52 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs @@ -55,7 +55,7 @@ private bool TryGetOnLeftOrRightDoor(out PlacedTileObject door) return false; } - public override bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public override bool IsConnected(PlacedTileObject neighbourObject) { if(neighbourObject == null) return false; diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index c9a04da15b..ad451c4c2c 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -3,10 +3,12 @@ using JetBrains.Annotations; using SS3D.Core; using SS3D.Logging; +using SS3D.Systems.Tile.Connections; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; +using static UnityEditor.FilePathAttribute; namespace SS3D.Systems.Tile { @@ -206,27 +208,40 @@ public bool PlaceTileObject(TileObjectSo tileObjectSo, Vector3 placePosition, Di public void ClearTileObject(Vector3 placePosition, TileLayer layer) { TileObject[] tileObjects = GetTileObjects(placePosition); - tileObjects[(int)layer].ClearPlacedObject(); + TileObject tileObject = tileObjects[(int)layer]; + PlacedTileObject placed = tileObject.PlacedObject; - // Update any neighbouring adjacencies - ResetAdjacencies(placePosition, layer); + + if (placed != null && placed.TryGetComponent(out IAdjacencyConnector connector)) + { + List neighbours = connector.GetNeighbours(); + ResetAdjacencies(placed, tileObject, neighbours); + } // Remove any invalid tile combinations List toRemoveObjects = BuildChecker.GetToBeDestroyedObjects(tileObjects); foreach (TileObject removeObject in toRemoveObjects) { + placed = removeObject.PlacedObject; + + if (placed != null && placed.TryGetComponent(out connector)) + { + List neighbours = connector.GetNeighbours(); + ResetAdjacencies(placed, removeObject, neighbours); + } + removeObject.ClearPlacedObject(); - ResetAdjacencies(placePosition, removeObject.Layer); } } - private void ResetAdjacencies(Vector3 placePosition, TileLayer layer) + private void ResetAdjacencies(PlacedTileObject placed, TileObject location, List neighbours) { - var neighbourTiles = GetNeighbourPlacedObjects(layer, placePosition); - for (int i = 0; i < neighbourTiles.Length; i++) + foreach (PlacedTileObject neighbour in neighbours) { - neighbourTiles[i]?.UpdateSingleAdjacency(null, TileHelper.GetOpposite((Direction)i)); + placed.NeighbourAtDirectionOf(neighbour, out var dir); + location.ClearPlacedObject(); + neighbour?.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), null); } } From 26dacb355bf76b4bd02a1e45462ffa932999fb5e Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 15:19:02 +0100 Subject: [PATCH 54/87] adding the disposal connector scripts to prefabs --- .../Machines/Supply/DisposalBin.prefab | 18 +++++++++++++++++- .../Machines/Supply/DisposalOutlet.prefab | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab index 670f3861bb..04229cce6d 100644 --- a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab +++ b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalBin.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 7849163769786431713} - component: {fileID: 1871071288925904272} - component: {fileID: 834667898589736169} + - component: {fileID: 8748962403380742660} m_Layer: 0 m_Name: DisposalBin m_TagString: Untagged @@ -128,7 +129,7 @@ MonoBehaviour: _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 2 + k__BackingField: 110 k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 @@ -145,6 +146,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 05bf3c848b84c3b4db8ad292b49badf5, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &8748962403380742660 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2658310835758749969} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c8b1a8e25f9a0442a328450c55e1dcd, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 + _addedNetworkObject: {fileID: 1871071288925904272} + _networkObjectCache: {fileID: 0} --- !u!1 &3330818021912189620 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab index b2377ac60d..96b8fd6d0c 100644 --- a/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab +++ b/Assets/Content/WorldObjects/Furniture/Machines/Supply/DisposalOutlet.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 7849163769786431713} - component: {fileID: 1871071288925904272} - component: {fileID: 2869317171787391012} + - component: {fileID: -4327415787478915747} m_Layer: 0 m_Name: DisposalOutlet m_TagString: Untagged @@ -129,7 +130,7 @@ MonoBehaviour: _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 2 + k__BackingField: 165 k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 @@ -146,6 +147,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6b76aa9296aa20945be463a65f9e41b4, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &-4327415787478915747 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2658310835758749969} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c8b1a8e25f9a0442a328450c55e1dcd, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 + _addedNetworkObject: {fileID: 1871071288925904272} + _networkObjectCache: {fileID: 0} --- !u!1 &4356345215162223831 GameObject: m_ObjectHideFlags: 0 From 41b7ff36fa422cf66157daa020d5d8d74e187974 Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 16:06:33 +0100 Subject: [PATCH 55/87] add world origin for placed tile object. --- .../Systems/Tile/PlacedObjects/PlacedTileObject.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 4f598f132a..51b76d1bfc 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -35,7 +35,7 @@ public static PlacedTileObject Create(Vector3 worldPosition, Vector2Int origin, placedObject = placedGameObject.AddComponent(); } - placedObject.Setup(tileObjectSo, origin, dir); + placedObject.Setup(tileObjectSo, origin, worldPosition, dir); if (InstanceFinder.ServerManager != null) { @@ -59,6 +59,7 @@ public static PlacedTileObject Create(Vector3 worldPosition, Vector2Int origin, private Vector2Int _origin; private Direction _dir; private IAdjacencyConnector _connector; + private Vector2Int _worldOrigin; /// /// Returns a list of all grids positions that object occupies. @@ -68,6 +69,8 @@ public static PlacedTileObject Create(Vector3 worldPosition, Vector2Int origin, public Vector2Int Origin => _origin; + public Vector2Int WorldOrigin => _worldOrigin; + public TileObjectGenericType GenericType => _tileObjectSo.genericType; public TileObjectSpecificType SpecificType => _tileObjectSo.specificType; @@ -85,12 +88,13 @@ public static PlacedTileObject Create(Vector3 worldPosition, Vector2Int origin, /// /// /// - private void Setup(TileObjectSo tileObjectSo, Vector2Int origin, Direction dir) + private void Setup(TileObjectSo tileObjectSo, Vector2Int origin, Vector3 worldPosition, Direction dir) { _tileObjectSo = tileObjectSo; _origin = origin; _dir = dir; _connector = GetComponent(); + _worldOrigin = new Vector2Int((int)Math.Round(worldPosition.x), (int)Math.Round(worldPosition.z)); } /// @@ -196,7 +200,7 @@ public bool NeighbourAtDirectionOf(PlacedTileObject other, out Direction directi { direction = Direction.North; if (other == null) return false; - Vector2Int coordinateDifference = other.Origin - Origin; + Vector2Int coordinateDifference = other.WorldOrigin - WorldOrigin; if(coordinateDifference == Vector2Int.up) direction = Direction.North; From c2792c78b3d4720881902d61e6dd2e695a22ae88 Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 16:07:06 +0100 Subject: [PATCH 56/87] update neighbour if itself is updated --- .../Systems/Tile/Connections/AbstractHorizontalConnector.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index a2053902b2..4be770eadf 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -109,15 +109,11 @@ public virtual bool UpdateSingleConnection(Direction dir, PlacedTileObject neigh bool isConnected = IsConnected(neighbourObject); - - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); - bool isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); if (isUpdated) { + neighbourObject?.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); _syncedConnections = _adjacencyMap.SerializeToByte(); UpdateMeshAndDirection(); } From ee2cf6ca1ccf5e7e629322d3ca0038959c853665 Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 21:49:40 +0100 Subject: [PATCH 57/87] make disposal pipe work --- .../AbstractHorizontalConnector.cs | 2 +- .../AdjacencyTypes/PipeAdjacency.cs | 6 +- .../Connections/DisposalFurnitureConnector.cs | 2 +- .../DisposalPipeAdjacencyConnector.cs | 227 +++++++++--------- .../Connections/DoorAdjacencyConnector.cs | 2 +- .../Connections/MultiAdjacencyConnector.cs | 2 +- .../Connections/SimpleAdjacencyConnector.cs | 2 + .../Tile/PlacedObjects/PlacedTileObject.cs | 4 +- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 14 +- 9 files changed, 134 insertions(+), 127 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index 4be770eadf..fe2efaa997 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -113,7 +113,7 @@ public virtual bool UpdateSingleConnection(Direction dir, PlacedTileObject neigh if (isUpdated) { - neighbourObject?.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); + neighbourObject?.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject, false); _syncedConnections = _adjacencyMap.SerializeToByte(); UpdateMeshAndDirection(); } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs index 91ce814736..3bc2706e6f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs @@ -26,7 +26,7 @@ public struct DisposalPipeConnector [Tooltip("A mesh where the South & south edges are connected")] public Mesh verticalMesh; - public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap, bool vertical) + public Tuple GetMeshRotationShape(AdjacencyMap adjacencyMap, bool vertical) { // Determine rotation and mesh specially for every single case. float rotation = 0; @@ -70,9 +70,7 @@ public MeshDirectionInfo GetMeshAndDirection(AdjacencyMap adjacencyMap, bool ver break; } - MeshDirectionInfo MeshAndDirection = new MeshDirectionInfo { Mesh = mesh, Rotation = rotation } ; - - return MeshAndDirection; + return new Tuple(mesh, rotation, shape); } private AdjacencyShape GetPipeShape(AdjacencyMap adjacencyMap, bool vertical) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs index 53e24b64c8..ab9beb57c6 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs @@ -59,7 +59,7 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje // Update our neighbour as well if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); + neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject, true); return updated; } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 176cb44477..df523aeab3 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -6,6 +6,7 @@ using SS3D.Systems.Furniture; using SS3D.Systems.Tile.Connections; using SS3D.Systems.Tile.Connections.AdjacencyTypes; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -40,6 +41,8 @@ public class DisposalPipeAdjacencyConnector : NetworkActor, IAdjacencyConnector public int HorizontalConnectionCount => _adjacencyMap.CardinalConnectionCount; + private AdjacencyShape _currentShape; + private void Setup() { @@ -65,33 +68,79 @@ public bool IsConnected(PlacedTileObject neighbourObject) { if (neighbourObject == null) return false; - TileSystem tileSystem = Subsystems.Get(); - var map = tileSystem.CurrentMap; + if (_verticalConnection == true + && neighbourObject.TryGetComponent(out DisposalPipeAdjacencyConnector neighbourConnector)) + return IsVerticalAndNeighbourInRightPosition(neighbourObject); - TryGetDisposalElementAbovePipe(out var aboveDisposalElement); + if (neighbourObject.TryGetComponent(out var disposalFurniture)) + return IsConnectedToDisposalFurniture(neighbourObject); - if(neighbourObject.TryGetComponent(out var neighbourElement) - && neighbourElement == aboveDisposalElement) - { - return true; - } + if(neighbourObject.TryGetComponent(out DisposalPipeAdjacencyConnector neighbourConnectorAgain) + && neighbourConnectorAgain._verticalConnection == true) + return IsConnectedToVerticalPipe(neighbourObject); bool isConnected; - isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); + isConnected = neighbourObject.HasAdjacencyConnector; isConnected &= neighbourObject.SpecificType == _specificType; return isConnected; } - private bool TryGetDisposalElementAbovePipe(out IDisposalElement disposalOutlet) + /// + /// check if the neighbour disposal pipe of this is connected to this, when this is a vertical pipe. + /// Basically check if the neighbour is positionned in front of the vertical pipe. + /// + private bool IsVerticalAndNeighbourInRightPosition(PlacedTileObject neighbourObject) + { + bool isConnected = neighbourObject != null; + isConnected &= _placedObject.NeighbourAtDirectionOf(neighbourObject, out Direction direction); + isConnected &= _placedObject.Direction == direction; + return isConnected; + } + + /// + /// Check if neighbour is the disposal furniture just above this disposal pipe. + /// + private bool IsConnectedToDisposalFurniture(PlacedTileObject neighbourObject) + { + // check if neighbour is the disposal furniture just above this. + bool IsDisposalFurnitureAbove = false; + TryGetDisposalElementAbovePipe(out var aboveDisposalFurniture); + + if (neighbourObject.TryGetComponent(out var disposalFurniture) + && disposalFurniture == aboveDisposalFurniture) + { + IsDisposalFurnitureAbove = true; + } + + return IsDisposalFurnitureAbove && HorizontalConnectionCount < 2; + } + + /// + /// Check if this disposal pipe is connected to its neighbour disposal pipe, when the neighbour is a vertical pipe. + /// + private bool IsConnectedToVerticalPipe(PlacedTileObject neighbourObject) + { + bool isConnected = neighbourObject != null; + isConnected &= neighbourObject.TryGetComponent(out DisposalPipeAdjacencyConnector neighbourConnector); + isConnected &= neighbourConnector._verticalConnection == true; + isConnected &= neighbourConnector._placedObject.NeighbourAtDirectionOf(_placedObject, out Direction direction); + isConnected &= neighbourConnector._placedObject.Direction == direction; + return isConnected; + } + + /// + /// Try to get the Disposal furniture (e.g : disposal bin) just above this disposal pipe, if it exists. + /// + private bool TryGetDisposalElementAbovePipe(out IDisposalElement disposalFurniture) { TileSystem tileSystem = Subsystems.Get(); var map = tileSystem.CurrentMap; TileChunk currentChunk = map.GetChunk(_placedObject.gameObject.transform.position); var furnitureLocation = currentChunk.GetTileObject(TileLayer.FurnitureBase, _placedObject.Origin.x, _placedObject.Origin.y); - disposalOutlet = furnitureLocation.PlacedObject?.GetComponent(); + disposalFurniture = furnitureLocation.PlacedObject?.GetComponent(); - return disposalOutlet != null; + return disposalFurniture != null; } /// @@ -102,67 +151,46 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje Setup(); bool isConnected = IsConnected(neighbourObject); + bool isUpdated; - bool isUpdated = false; - bool isVertical; - - - if(neighbourObject != null) + // If neighbour is a disposal furniture and this disposal pipe is connected to it + if (isConnected && IsConnectedToDisposalFurniture(neighbourObject)) { - if (neighbourObject.GetComponent() != null) - { - isVertical = true; - isUpdated = _verticalConnection != isVertical; - } - else - { - isVertical = false; - isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - } - - if (isUpdated && !isVertical) - { - _syncedConnections = _adjacencyMap.SerializeToByte(); - UpdateMeshAndDirection(); - } - - if (isUpdated && isVertical) - { - _verticalConnection = isVertical; - UpdateMeshAndDirection(); - } - - // Update our neighbour as well - if (isUpdated && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); + isUpdated = _verticalConnection != true; + _verticalConnection = true; + } - return isUpdated; + // If neighbour is a removed disposal furniture which used to be connected to this disposal pipe. + else if (neighbourObject == null + && !TryGetDisposalElementAbovePipe(out IDisposalElement disposalFurniture) + && _verticalConnection == true) + { + isUpdated = true; + _verticalConnection = false; } + + // Else it's not a disposal furniture and we simply use the adjacency map for horizontal connections + // with other Disposal pipes. else { - // the disposal above gets removed - if(!TryGetDisposalElementAbovePipe(out var disposalFurniture) && _verticalConnection == true) - { - _verticalConnection = false; - isUpdated = true; - } - // another pipe get removed - else - { - isUpdated = _adjacencyMap.SetConnection(dir, - new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - } + isUpdated = _adjacencyMap.SetConnection(dir, + new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); + } + + if (isUpdated) + { + UpdateMeshAndDirection(); + } - if (isUpdated) + if (isUpdated && updateNeighbour) + { + var connector = neighbourObject?.GetComponent(); + if(connector != null) { - UpdateMeshAndDirection(); + connector.UpdateAllConnections(new PlacedTileObject[] { }); } } - - // Update our neighbour as well - if (isUpdated && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); - + return isUpdated; } @@ -172,16 +200,14 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) { Setup(); + neighbourObjects = GetNeighbours().ToArray(); + bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) - { - changed |= UpdateSingleConnection((Direction) i,neighbourObjects[i], true); - } - if(TryGetDisposalElementAbovePipe(out IDisposalElement disposalElement)) + foreach (var neighbourObject in neighbourObjects) { - var placedDisposal = disposalElement.GameObject.GetComponent(); - changed |= UpdateSingleConnection(Direction.North, placedDisposal, false) ; + _placedObject.NeighbourAtDirectionOf(neighbourObject, out Direction dir); + changed |= UpdateSingleConnection(dir, neighbourObject, true); } if (changed) @@ -192,42 +218,29 @@ public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) protected virtual void UpdateMeshAndDirection() { - var info = _pipeAdjacency.GetMeshAndDirection(_adjacencyMap, _verticalConnection); + var info = _pipeAdjacency.GetMeshRotationShape(_adjacencyMap, _verticalConnection); transform.localRotation = Quaternion.identity; Vector3 pos = transform.position; Quaternion localRotation = _filter.transform.localRotation; Vector3 eulerRotation = localRotation.eulerAngles; - _filter.mesh = info.Mesh; + _filter.mesh = info.Item1; - if (info.Mesh == _pipeAdjacency.verticalMesh) + + if (info.Item3 == AdjacencyShape.Vertical) { - _isVertical= true; - transform.position = new Vector3(pos.x, -0.67f, pos.z); + // remove some y so the vertical model is at the right place in the ground. + transform.position = new Vector3(pos.x, -0.67f, pos.z); _filter.transform.localRotation = Quaternion.Euler(eulerRotation.x, TileHelper.GetRotationAngle(_placedObject.Direction), eulerRotation.z); - - if (!_isVertical) - { - var directions = TileHelper.AllDirections(); - directions.Remove(TileHelper.GetOpposite(_placedObject.Direction)); - SetBlockedDirection(directions, false); - - } - - return; } - else if (_filter.mesh == _pipeAdjacency.verticalMesh) + else { + // reinitialize y to 0 if the model is non vertical. transform.position = new Vector3(pos.x, 0f, pos.z); + _filter.transform.localRotation = Quaternion.Euler(eulerRotation.x, info.Item2, eulerRotation.z); } - if (info.Mesh != _pipeAdjacency.verticalMesh) - { - _isVertical = false; - } - - localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); - _filter.transform.localRotation = localRotation; + _currentShape = info.Item3; } /// @@ -245,46 +258,32 @@ private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) } /// - /// Sync adjacency map on client, and update mesh and direction using this new map. + /// Sync vertical on client, and update mesh and direction. /// private void SyncVertical(bool oldValue, bool newValue, bool asServer) { if (!asServer) { Setup(); - - _verticalConnection = newValue; UpdateMeshAndDirection(); } } - /// - /// Sets a given direction blocked or unblocked. - /// If blocked, this means that it will no longer be allowed to connect on that direction (until further update). - /// - private void SetBlockedDirection(List directions, bool value) - { - foreach(var dir in directions) - { - _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, value)); - } - - UpdateMeshAndDirection(); - } - public List GetNeighbours() { PlacedTileObject placedDisposal = null; - List neighbours; + List neighbours = new(); if (TryGetDisposalElementAbovePipe(out IDisposalElement disposalElement)) { placedDisposal = disposalElement.GameObject.GetComponent(); } + if (placedDisposal != null) + neighbours.Add(placedDisposal); + TileSystem tileSystem = Subsystems.Get(); var map = tileSystem.CurrentMap; - neighbours = map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position).ToList(); - if(placedDisposal != null) - neighbours.Add(placedDisposal); + neighbours.AddRange(map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position)); + neighbours.RemoveAll(x => x == null); return neighbours; } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index 5961c85588..20bb3dd6d6 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -22,7 +22,7 @@ private enum DoorType protected override IMeshAndDirectionResolver AdjacencyResolver => null; - /** Based on peculiarities of the model, the appropriate position of the wall cap */ + // Based on peculiarities of the model, the appropriate position of the wall cap private const float WALL_CAP_DISTANCE_FROM_CENTRE = 0f; // As is the standard in the rest of the code, wallCap should face east. diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs index 3f10e5781d..c163ec4ee8 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs @@ -88,7 +88,7 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje // Update our neighbour as well if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject); + neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject, false); } isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs index 42f73422ca..df2f6f354d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/SimpleAdjacencyConnector.cs @@ -12,6 +12,8 @@ namespace SS3D.Systems.Tile.Connections { /// /// Basic connector using the simple connector struct for resolving shape and direction. + /// Things do not need special connections in corners. + /// The only condition to connect to a neighbour is that they share generic and specific type. /// public class SimpleAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 51b76d1bfc..39418099c1 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -111,10 +111,10 @@ public void UpdateAdjacencies(PlacedTileObject[] neighbourObjects) _connector.UpdateAllConnections(neighbourObjects); } - public void UpdateSingleAdjacency(Direction dir, PlacedTileObject neighbourObject) + public void UpdateSingleAdjacency(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { if (HasAdjacencyConnector) - _connector.UpdateSingleConnection(dir, neighbourObject, false); + _connector.UpdateSingleConnection(dir, neighbourObject, updateNeighbour); } public SavedPlacedTileObject Save() diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index ad451c4c2c..01b0aaac64 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -237,11 +237,19 @@ public void ClearTileObject(Vector3 placePosition, TileLayer layer) private void ResetAdjacencies(PlacedTileObject placed, TileObject location, List neighbours) { + List neighboursAtDirection= new List(); foreach (PlacedTileObject neighbour in neighbours) { - placed.NeighbourAtDirectionOf(neighbour, out var dir); - location.ClearPlacedObject(); - neighbour?.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), null); + placed.NeighbourAtDirectionOf(neighbour, out var dir); + neighboursAtDirection.Add(dir); + } + location.ClearPlacedObject(); + int i = 0; + foreach (PlacedTileObject neighbour in neighbours) + { + Direction dir = neighboursAtDirection[i]; + neighbour?.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), null, false); + i++; } } From 79ef9591987081370ebeb4d2a76a2ff2372c0b12 Mon Sep 17 00:00:00 2001 From: stilnat Date: Wed, 1 Nov 2023 21:54:11 +0100 Subject: [PATCH 58/87] remove random using --- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index 01b0aaac64..3f18da3b34 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -8,7 +8,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using static UnityEditor.FilePathAttribute; namespace SS3D.Systems.Tile { From 3a56f32cfb908afd22002bf9e84627514b1fb56b Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 2 Nov 2023 01:07:56 +0100 Subject: [PATCH 59/87] fix disposal pipes --- .../Pipes/Disposals/DisposalPipes.prefab | 20 ++++++++- .../Connections/DisposalFurnitureConnector.cs | 4 +- .../DisposalPipeAdjacencyConnector.cs | 45 +++++++++++++------ .../Tile/PlacedObjects/PlacedTileObject.cs | 5 ++- 4 files changed, 56 insertions(+), 18 deletions(-) diff --git a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab index 7f718fe5b0..9d5e11d61f 100644 --- a/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab +++ b/Assets/Content/WorldObjects/Structures/Pipes/Disposals/DisposalPipes.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 355159483773011154} - component: {fileID: 1702746743542006300} - component: {fileID: 6841799689541215485} + - component: {fileID: 4188904223884923263} m_Layer: 0 m_Name: DisposalPipes m_TagString: Untagged @@ -56,8 +57,8 @@ MonoBehaviour: k__BackingField: [] SerializedTransformProperties: Position: {x: 0, y: 0, z: 0} - Rotation: {x: 0, y: 0, z: 0, w: 0} - LocalScale: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 1} + LocalScale: {x: 1, y: 1, z: 1} _isNetworked: 1 _isGlobal: 0 _initializeOrder: 0 @@ -143,3 +144,18 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!114 &4188904223884923263 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2802364579275783218} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ff65a9dda1ef18f4cbc16ee4d1aee066, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 + _addedNetworkObject: {fileID: -7727686409064562107} + _networkObjectCache: {fileID: 0} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs index ab9beb57c6..71f5d12021 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs @@ -58,8 +58,8 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje bool updated = _connectedToPipe != isConnected; // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject, true); + if (updated) + neighbourObject.UpdateAdjacencies(new PlacedTileObject[0]); return updated; } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index df523aeab3..43d488e915 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -24,6 +24,9 @@ public class DisposalPipeAdjacencyConnector : NetworkActor, IAdjacencyConnector [SyncVar(OnChange = nameof(SyncVertical))] protected bool _verticalConnection; + [SyncVar(OnChange = nameof(SyncDirection))] + protected Direction _direction; + protected MeshFilter _filter; protected PlacedTileObject _placedObject; @@ -50,16 +53,19 @@ private void Setup() { _adjacencyMap = new AdjacencyMap(); _filter = GetComponent(); - - _placedObject = GetComponent(); - if (_placedObject == null) + if (IsServer) { - _specificType = TileObjectSpecificType.None; - } - else - { - _specificType = _placedObject.SpecificType; + _placedObject = GetComponent(); + if (_placedObject == null) + { + _specificType = TileObjectSpecificType.None; + } + else + { + _specificType = _placedObject.SpecificType; + } } + _initialized = true; } } @@ -152,6 +158,7 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje bool isConnected = IsConnected(neighbourObject); bool isUpdated; + bool neighbourIsRemovedDisposalFurniture = false; // If neighbour is a disposal furniture and this disposal pipe is connected to it if (isConnected && IsConnectedToDisposalFurniture(neighbourObject)) @@ -165,6 +172,7 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje && !TryGetDisposalElementAbovePipe(out IDisposalElement disposalFurniture) && _verticalConnection == true) { + neighbourIsRemovedDisposalFurniture = true; isUpdated = true; _verticalConnection = false; } @@ -179,16 +187,18 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje if (isUpdated) { + _syncedConnections = _adjacencyMap.SerializeToByte(); + _direction = _placedObject.Direction; UpdateMeshAndDirection(); - } - - if (isUpdated && updateNeighbour) - { var connector = neighbourObject?.GetComponent(); if(connector != null) { connector.UpdateAllConnections(new PlacedTileObject[] { }); } + if (neighbourIsRemovedDisposalFurniture) + { + UpdateAllConnections(new PlacedTileObject[] { }); + } } return isUpdated; @@ -231,7 +241,7 @@ protected virtual void UpdateMeshAndDirection() { // remove some y so the vertical model is at the right place in the ground. transform.position = new Vector3(pos.x, -0.67f, pos.z); - _filter.transform.localRotation = Quaternion.Euler(eulerRotation.x, TileHelper.GetRotationAngle(_placedObject.Direction), eulerRotation.z); + _filter.transform.localRotation = Quaternion.Euler(eulerRotation.x, TileHelper.GetRotationAngle(_direction), eulerRotation.z); } else { @@ -269,6 +279,15 @@ private void SyncVertical(bool oldValue, bool newValue, bool asServer) } } + private void SyncDirection(Direction oldValue, Direction newValue, bool asServer) + { + if (!asServer) + { + Setup(); + UpdateMeshAndDirection(); + } + } + public List GetNeighbours() { PlacedTileObject placedDisposal = null; diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index 39418099c1..f067c19503 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -17,7 +17,8 @@ namespace SS3D.Systems.Tile public class PlacedTileObject: NetworkBehaviour { /// - /// Creates a new PlacedTileObject from a TileObjectSO at a given position and direction. Uses NetworkServer.Spawn() if a server is running. + /// Creates a new PlacedTileObject from a TileObjectSO at a given position and direction. + /// Uses NetworkServer.Spawn() if a server is running. /// /// /// @@ -37,6 +38,8 @@ public static PlacedTileObject Create(Vector3 worldPosition, Vector2Int origin, placedObject.Setup(tileObjectSo, origin, worldPosition, dir); + // TODO : Spawning the placed game object does not spawn with it everything. In particular, the values + // such as tileobjectSO, origin or world position are not spawned. This might (or not) be an issue later on. if (InstanceFinder.ServerManager != null) { if (placedObject.GetComponent() == null) From b8fcf52d359ff7639b49733256c6962844193afc Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 2 Nov 2023 01:24:30 +0100 Subject: [PATCH 60/87] remove neighbour objects parameter from updateAllConnections --- .../Tile/Connections/AbstractHorizontalConnector.cs | 13 +++++++++---- .../Tile/Connections/DisposalFurnitureConnector.cs | 4 ++-- .../Connections/DisposalPipeAdjacencyConnector.cs | 8 ++++---- .../Tile/Connections/DoorAdjacencyConnector.cs | 4 ++-- .../Systems/Tile/Connections/IAdjacencyConnector.cs | 2 +- .../Tile/Connections/MultiAdjacencyConnector.cs | 9 ++++++--- .../Systems/Tile/PlacedObjects/PlacedTileObject.cs | 4 ++-- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 5 ++--- 8 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index fe2efaa997..a2fb9b4a2a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -84,14 +84,17 @@ private void Setup() /// /// Update all connections around this connector, updating mesh and directions eventually. /// - public virtual void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + public virtual void UpdateAllConnections() { Setup(); + var neighbourObjects = GetNeighbours(); + bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) + foreach (var neighbourObject in neighbourObjects) { - changed |= UpdateSingleConnection((Direction) i, neighbourObjects[i], true); + _placedObject.NeighbourAtDirectionOf(neighbourObject, out Direction dir); + changed |= UpdateSingleConnection(dir, neighbourObject, true); } if (changed) @@ -173,7 +176,9 @@ public List GetNeighbours() { TileSystem tileSystem = Subsystems.Get(); var map = tileSystem.CurrentMap; - return map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position).ToList(); + var neighbours = map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position).ToList(); + neighbours.RemoveAll(x => x == null); + return neighbours; } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs index 71f5d12021..5d7f56e734 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs @@ -39,7 +39,7 @@ public bool IsConnected(PlacedTileObject neighbourObject) return true; } - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections() { // update pipe just below. Setup(); @@ -59,7 +59,7 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje // Update our neighbour as well if (updated) - neighbourObject.UpdateAdjacencies(new PlacedTileObject[0]); + neighbourObject.UpdateAdjacencies(); return updated; } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 43d488e915..0fbea11c36 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -193,11 +193,11 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje var connector = neighbourObject?.GetComponent(); if(connector != null) { - connector.UpdateAllConnections(new PlacedTileObject[] { }); + connector.UpdateAllConnections(); } if (neighbourIsRemovedDisposalFurniture) { - UpdateAllConnections(new PlacedTileObject[] { }); + UpdateAllConnections(); } } @@ -206,11 +206,11 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje // TODO : maybe interface should let updateAllconnections handle retrieving neighbours // object, as it might not mean the same thing for different connectors. - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections() { Setup(); - neighbourObjects = GetNeighbours().ToArray(); + var neighbourObjects = GetNeighbours(); bool changed = false; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs index 20bb3dd6d6..03bfc75bb4 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DoorAdjacencyConnector.cs @@ -43,9 +43,9 @@ public override bool UpdateSingleConnection(Direction dir, PlacedTileObject plac return update; } - public override void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + public override void UpdateAllConnections() { - base.UpdateAllConnections(neighbourObjects); + base.UpdateAllConnections(); UpdateWallCaps(); } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs index ef5ab87585..55dfc14363 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs @@ -9,7 +9,7 @@ namespace SS3D.Systems.Tile.Connections public interface IAdjacencyConnector { bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour); - void UpdateAllConnections(PlacedTileObject[] neighbourObjects); + void UpdateAllConnections(); bool IsConnected(PlacedTileObject neighbourObject); List GetNeighbours(); } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs index c163ec4ee8..79035fd415 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs @@ -101,14 +101,17 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje return isUpdated; } - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections() { Setup(); + var neighbourObjects = GetNeighbours(); + bool changed = false; - for (int i = 0; i < neighbourObjects.Length; i++) + foreach (var neighbourObject in neighbourObjects) { - changed |= UpdateSingleConnection((Direction)i, neighbourObjects[i], true); + _placedObject.NeighbourAtDirectionOf(neighbourObject, out Direction dir); + changed |= UpdateSingleConnection(dir, neighbourObject, true); } if (changed) diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index f067c19503..73d5d9ad09 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -108,10 +108,10 @@ public void DestroySelf() InstanceFinder.ServerManager.Despawn(gameObject); } - public void UpdateAdjacencies(PlacedTileObject[] neighbourObjects) + public void UpdateAdjacencies() { if (HasAdjacencyConnector) - _connector.UpdateAllConnections(neighbourObjects); + _connector.UpdateAllConnections(); } public void UpdateSingleAdjacency(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index 3f18da3b34..3c0b991833 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -195,8 +195,7 @@ public bool PlaceTileObject(TileObjectSo tileObjectSo, Vector3 placePosition, Di // Handle Adjacency connectors, can skip it particulary when loading the map. if (!skipAdjacency){ - var neighbourTiles = GetNeighbourPlacedObjects(tileObjectSo.layer, placePosition); - placedObject.UpdateAdjacencies(neighbourTiles); + placedObject.UpdateAdjacencies(); } } @@ -368,7 +367,7 @@ private void UpdateAllAdjacencies() if (obj.HasAdjacencyConnector) { var pos = chunk.GetWorldPosition(obj.Origin.x, obj.Origin.y); - obj.UpdateAdjacencies(GetNeighbourPlacedObjects(obj.Layer, pos)); + obj.UpdateAdjacencies(); } } } From 6c2ba53cbf96d2e08ef6bcc7164ffb19ba5531f3 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 2 Nov 2023 01:35:09 +0100 Subject: [PATCH 61/87] doc on the interface --- .../Tile/Connections/IAdjacencyConnector.cs | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs index 55dfc14363..cf71d2e47b 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/IAdjacencyConnector.cs @@ -5,12 +5,40 @@ namespace SS3D.Systems.Tile.Connections /// /// Interface that all adjacency connectors should use. /// - /// TODO : add getneighbours method, remove neighbour parameters. public interface IAdjacencyConnector { + /// + /// Update a single connection, and eventually update the neighbour as well. + /// neighbour object can be null, which generally means the neighbour object is removed. + /// dir should indicate the direction in which the neighbour object is, if it makes sense, and if + /// it's useful. For some neighbours,in some particula cases, it might not be useful. + /// e.g : Disposal furniture above disposal pipes, in that case direction is not useful, so it can take + /// any value. + /// bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour); + + /// + /// Update all connections of this Connector, generally, it means update all neighbour placed tile + /// objects of the placed object linked to this connector. + /// void UpdateAllConnections(); + + /// + /// Check if a given neighbour of the placed object linked to this connector is connected to + /// the placed object linked to this connector. Connection conditions + /// may vary widely from a connector to another. + /// bool IsConnected(PlacedTileObject neighbourObject); + + /// + /// Get all neighbours from the placed object this connector is attached to. + /// The definition of neighbours may vary from one connector to another. + /// For most, it'll simply be other placed object placed on the same layer, on adjacent tiles. + /// Some might have more exotic definitions, such as the disposal pipes, which can consider + /// some disposal furnitures to be their neighbour. + /// A neighbour is a potential candidate for a connection, it means the placed object + /// linked to this connector will not necessarily be connected with its neighbour. + /// List GetNeighbours(); } } \ No newline at end of file From 838f3bb8f2b12fb6330b3d5559f818699ef3abaf Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 2 Nov 2023 01:36:45 +0100 Subject: [PATCH 62/87] clean doc --- .../Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 0fbea11c36..507317c8e1 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -149,9 +149,6 @@ private bool TryGetDisposalElementAbovePipe(out IDisposalElement disposalFurnitu return disposalFurniture != null; } - /// - /// Update a single connection, in a specific direction. Eventually also update the neighbour connection. - /// public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { Setup(); From 700b8c63186967deb3848987cda0cacc94dd8cc2 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 2 Nov 2023 11:04:09 +0100 Subject: [PATCH 63/87] put back the right disposal pipes file --- .../Structures/Pipes/DisposalPipes.fbx.meta | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta b/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta index 68373a927b..edd5744ee8 100644 --- a/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta +++ b/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta @@ -1,16 +1,11 @@ fileFormatVersion: 2 guid: 8fa7941da6a6a8d4da717a97b11b2621 ModelImporter: - serializedVersion: 21202 + serializedVersion: 21300 internalIDToNameTable: [] - externalObjects: - - first: - type: UnityEngine:Material - assembly: UnityEngine.CoreModule - name: Palette05 - second: {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} + externalObjects: {} materials: - materialImportMode: 1 + materialImportMode: 2 materialName: 0 materialSearch: 1 materialLocation: 1 @@ -19,7 +14,7 @@ ModelImporter: bakeSimulation: 0 resampleCurves: 1 optimizeGameObjects: 0 - removeConstantScaleCurves: 0 + removeConstantScaleCurves: 1 motionNodeName: rigImportErrors: rigImportWarnings: @@ -49,8 +44,8 @@ ModelImporter: importBlendShapes: 1 importCameras: 1 importLights: 1 - nodeNameCollisionStrategy: 0 - fileIdsGeneration: 1 + nodeNameCollisionStrategy: 1 + fileIdsGeneration: 2 swapUVChannels: 0 generateSecondaryUV: 0 useFileUnits: 1 @@ -103,7 +98,8 @@ ModelImporter: animationType: 2 humanoidOversampling: 1 avatarSetup: 0 - addHumanoidExtraRootOnlyWhenUsingAvatar: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + remapMaterialsIfMaterialImportModeIsNone: 0 additionalBone: 0 userData: assetBundleName: From 11cc5403e7ca22c6c4043dda0bc7b24277893860 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 2 Nov 2023 12:18:04 +0100 Subject: [PATCH 64/87] complete doc --- .../Systems/Furniture/IDisposalElement.cs | 5 ++ .../AbstractHorizontalConnector.cs | 38 ++++++++- .../AdjacencyTypes/PipeAdjacency.cs | 10 ++- .../Connections/DisposalFurnitureConnector.cs | 21 ++++- .../DisposalPipeAdjacencyConnector.cs | 85 ++++++++++++------- .../Connections/PipeAdjacencyConnector.cs | 3 + .../Tile/Connections/TileObjectType.cs | 3 +- .../Connections/WallAdjacencyConnector.cs | 23 ++++- .../SS3D/Systems/Tile/TileConstants.cs | 6 ++ .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 7 +- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 8 ++ Assets/Scripts/SS3D/Utils/MathUtility.cs | 6 ++ 12 files changed, 172 insertions(+), 43 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs b/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs index 30f200c03c..c23a54d908 100644 --- a/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs +++ b/Assets/Scripts/SS3D/Systems/Furniture/IDisposalElement.cs @@ -5,6 +5,11 @@ namespace SS3D.Systems.Furniture { + /// + /// A simple interface for all disposal furniture. It helps with abstracting over the type + /// of furnitures, when they all need to be treated the same. e.g : disposal pipes + /// wants to connect with disposal elements, they don't care about their specificity. + /// public interface IDisposalElement : IGameObjectProvider { diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs index a2fb9b4a2a..f7a7fa2d84 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AbstractHorizontalConnector.cs @@ -23,24 +23,50 @@ namespace SS3D.Systems.Tile.Connections /// public abstract class AbstractHorizontalConnector : NetworkActor, IAdjacencyConnector { + /// + /// Is this a table ? A Door ? A carpet ? A pipe ? + /// protected TileObjectGenericType _genericType; + /// + /// Is this a wooden table ? A glass table ? A poker table ? + /// protected TileObjectSpecificType _specificType; + /// + /// Script that help with resolving the specific mesh a connectable should take. + /// protected abstract IMeshAndDirectionResolver AdjacencyResolver { get; } + /// + /// A structure containing data regarding connection of this PlacedTileObject with all 8 + /// adjacent neighbours (cardinal and diagonal connections). + /// protected AdjacencyMap _adjacencyMap; + /// + /// The specific mesh this connectable has. + /// protected MeshFilter _filter; + /// + /// The Placed tile object linked to this connector. It's this placed object that this + /// connector update. + /// protected PlacedTileObject _placedObject; public PlacedTileObject PlacedObject => _placedObject; + /// + /// A byte, representing the 8 possible connections with neighbours. + /// [SyncVar(OnChange = nameof(SyncAdjacencies))] private byte _syncedConnections; + /// + /// Upon Setup, this should stay true. + /// private bool _initialized; /// @@ -138,11 +164,12 @@ private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) } } - + /// + /// Update the current mesh of the game object this connector is onto, as well + /// as it's rotation. + /// protected virtual void UpdateMeshAndDirection() { - // Some connectors might not have to update mesh or direction at all. - // E.g : door connectors. if (AdjacencyResolver == null) return; MeshDirectionInfo info = new(); @@ -172,6 +199,11 @@ public void SetBlockedDirection(Direction dir, bool value) UpdateMeshAndDirection(); } + /// + /// Get all neighbour placed objects from this placed object. + /// Return only existing neighbours. Neighbours here are adjacent (cardinal and diagonal) + /// tile objects on the same layer. + /// public List GetNeighbours() { TileSystem tileSystem = Subsystems.Get(); diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs index 3bc2706e6f..f31bcb3a28 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/PipeAdjacency.cs @@ -4,7 +4,8 @@ namespace SS3D.Systems.Tile.Connections.AdjacencyTypes { /// - /// + /// Script helping disposal pipes to determine their shape, mesh and rotation. + /// Disposal pipes are a bit special because they can connect vertically with disposal furniture. /// [Serializable] public struct DisposalPipeConnector @@ -26,9 +27,14 @@ public struct DisposalPipeConnector [Tooltip("A mesh where the South & south edges are connected")] public Mesh verticalMesh; + /// + /// Get all info needed to update correctly disposal pipes. + /// + /// Disposal pipe connections with all horizontal neighbours + /// Disposal pipe connections with its single potential + /// vertical neighbour. True if it exists. public Tuple GetMeshRotationShape(AdjacencyMap adjacencyMap, bool vertical) { - // Determine rotation and mesh specially for every single case. float rotation = 0; Mesh mesh; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs index 5d7f56e734..b3b0402444 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs @@ -12,6 +12,11 @@ namespace SS3D.Systems.Tile.Connections { + /// + /// Connector for disposal furniture. e.g disposal outlets and disposal bins. + /// It doesn't do much, except checking for an available pipe just below itself, and + /// signaling this pipe to update itself upon adding or clearing the disposal furniture. + /// public class DisposalFurnitureConnector : NetworkActor, IAdjacencyConnector { private PlacedTileObject _placedObject; @@ -23,6 +28,10 @@ private void Setup() _placedObject = GetComponent(); } + /// + /// Disposal furnitures are connected when they have a disposal pipe just below them + /// and this pipe has less than two connections already. + /// public bool IsConnected(PlacedTileObject neighbourObject) { if(neighbourObject == null) return false; @@ -41,10 +50,11 @@ public bool IsConnected(PlacedTileObject neighbourObject) public void UpdateAllConnections() { - // update pipe just below. + Setup(); - if(TryGetPipeBelow(out PlacedTileObject pipe)) + // update pipe just below. + if (TryGetPipeBelow(out PlacedTileObject pipe)) { UpdateSingleConnection(Direction.North, pipe, true); }; @@ -57,13 +67,15 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje bool isConnected = IsConnected(neighbourObject); bool updated = _connectedToPipe != isConnected; - // Update our neighbour as well if (updated) neighbourObject.UpdateAdjacencies(); return updated; } + /// + /// Just get the pipe below the disposal furniture if it exists. + /// private bool TryGetPipeBelow(out PlacedTileObject pipe) { TileSystem tileSystem = Subsystems.Get(); @@ -76,6 +88,9 @@ private bool TryGetPipeBelow(out PlacedTileObject pipe) return pipe != null; } + /// + /// The only neighbour of a disposal furniture is the eventual disposal pipe just below it. + /// public List GetNeighbours() { bool hasNeighbour = TryGetPipeBelow(out PlacedTileObject pipe); diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 507317c8e1..46b038531e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -15,37 +15,63 @@ namespace SS3D.Systems.Tile.Connections { + /// + /// Connector for disposal pipes only. + /// public class DisposalPipeAdjacencyConnector : NetworkActor, IAdjacencyConnector { + /// + /// Structure helping to determine disposal pipes shape and rotation. + /// [SerializeField] private DisposalPipeConnector _pipeAdjacency; - protected AdjacencyMap _adjacencyMap; + /// + /// Adjacency map for all horizontal connections. + /// + private AdjacencyMap _adjacencyMap; + /// + /// true if connected to a disposal furniture. + /// [SyncVar(OnChange = nameof(SyncVertical))] - protected bool _verticalConnection; + private bool _verticalConnection; + /// + /// Direction of the disposal pipe. Useful to update it on client. + /// [SyncVar(OnChange = nameof(SyncDirection))] - protected Direction _direction; + private Direction _direction; - protected MeshFilter _filter; + /// + /// The mesh of the disposal pipe. + /// + private MeshFilter _filter; - protected PlacedTileObject _placedObject; + /// + /// The placed object for this disposal pipe. + /// + private PlacedTileObject _placedObject; - public PlacedTileObject PlacedObject => _placedObject; + /// + /// A byte, representing the 8 possible connections with other pipes neighbours. + /// [SyncVar(OnChange = nameof(SyncAdjacencies))] private byte _syncedConnections; + /// + /// Upon Setup, this should stay true. + /// private bool _initialized; - protected TileObjectSpecificType _specificType; - private bool _isVertical = false; + private TileObjectGenericType _disposalType = TileObjectGenericType.Disposal; + /// + /// Number of horizontal connections of the disposal pipe, only count cardinal connections. + /// public int HorizontalConnectionCount => _adjacencyMap.CardinalConnectionCount; - private AdjacencyShape _currentShape; - private void Setup() { @@ -53,23 +79,17 @@ private void Setup() { _adjacencyMap = new AdjacencyMap(); _filter = GetComponent(); - if (IsServer) - { - _placedObject = GetComponent(); - if (_placedObject == null) - { - _specificType = TileObjectSpecificType.None; - } - else - { - _specificType = _placedObject.SpecificType; - } - } - + _placedObject = GetComponent(); _initialized = true; } } + /// + /// Connection for disposal pipes is not completely trivial. Disposal pipes should + /// not connect to neighbour pipe if they are vertical, unless they are in front of them. + /// If there is a disposal furniture above them, they should connected to it if they have a single + /// connection or none. They otherwise connect only to other disposal pipes. + /// public bool IsConnected(PlacedTileObject neighbourObject) { if (neighbourObject == null) return false; @@ -85,10 +105,7 @@ public bool IsConnected(PlacedTileObject neighbourObject) && neighbourConnectorAgain._verticalConnection == true) return IsConnectedToVerticalPipe(neighbourObject); - bool isConnected; - isConnected = neighbourObject.HasAdjacencyConnector; - isConnected &= neighbourObject.SpecificType == _specificType; - return isConnected; + return neighbourObject.HasAdjacencyConnector && neighbourObject.GenericType == _disposalType; } /// @@ -187,6 +204,9 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje _syncedConnections = _adjacencyMap.SerializeToByte(); _direction = _placedObject.Direction; UpdateMeshAndDirection(); + + // Update neighbour connector if they are pipes, + // and itself in all directions if it just removed a furniture above var connector = neighbourObject?.GetComponent(); if(connector != null) { @@ -201,8 +221,6 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje return isUpdated; } - // TODO : maybe interface should let updateAllconnections handle retrieving neighbours - // object, as it might not mean the same thing for different connectors. public void UpdateAllConnections() { Setup(); @@ -246,8 +264,6 @@ protected virtual void UpdateMeshAndDirection() transform.position = new Vector3(pos.x, 0f, pos.z); _filter.transform.localRotation = Quaternion.Euler(eulerRotation.x, info.Item2, eulerRotation.z); } - - _currentShape = info.Item3; } /// @@ -276,6 +292,9 @@ private void SyncVertical(bool oldValue, bool newValue, bool asServer) } } + /// + /// Sync direction on the client, and update mesh and direction. + /// private void SyncDirection(Direction oldValue, Direction newValue, bool asServer) { if (!asServer) @@ -285,6 +304,10 @@ private void SyncDirection(Direction oldValue, Direction newValue, bool asServer } } + /// + /// Get the neighbours of this disposal pipe. This include all disposal pipes + /// adjacents (cardinal and diagonal) and eventually the disposal furniture above it. + /// public List GetNeighbours() { PlacedTileObject placedDisposal = null; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs index 05ea05e557..6fb7ba0526 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/PipeAdjacencyConnector.cs @@ -6,6 +6,9 @@ namespace SS3D.Systems.Tile.Connections { + /// + /// Simple connector for pipes with a possible offset, such as atmos pipes. + /// public class PipeAdjacencyConnector : AbstractHorizontalConnector { [SerializeField] diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs index 9190133b2d..37ace6275a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/TileObjectType.cs @@ -22,7 +22,8 @@ public enum TileObjectGenericType Counter, Cable, Wire, - Door + Door, + Disposal, } /// diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs index 6687009f52..8e272b0908 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/WallAdjacencyConnector.cs @@ -11,13 +11,24 @@ namespace SS3D.Systems.Tile.Connections { + /// + /// Walls are mostly simply working like advanced connectors, but there is a few exceptions, + /// in particular with the way they connect with doors, hence why they need their own connector + /// script. + /// public class WallAdjacencyConnector : AbstractHorizontalConnector, IAdjacencyConnector { - + /// + /// Script to help walls to choose their shape. + /// [SerializeField] private AdvancedConnector _advancedAdjacency; protected override IMeshAndDirectionResolver AdjacencyResolver => _advancedAdjacency; + /// + /// Check if this wall is conencted to the neighbour object when it's a door. + /// Walls only connect to doors when they are on left or on right of doors. + /// private bool IsConnectedToDoor(PlacedTileObject neighbourObject) { var doorConnector = neighbourObject.GetComponent(); @@ -33,6 +44,9 @@ private bool IsConnectedToDoor(PlacedTileObject neighbourObject) return false; } + /// + /// Try to get a door on the left or on the right of this wall. + /// private bool TryGetOnLeftOrRightDoor(out PlacedTileObject door) { var tileSystem = Subsystems.Get(); @@ -55,6 +69,10 @@ private bool TryGetOnLeftOrRightDoor(out PlacedTileObject door) return false; } + /// + /// Walls connect to other walls, and to doors, when doors are placed on their left or on their + /// right. + /// public override bool IsConnected(PlacedTileObject neighbourObject) { if(neighbourObject == null) return false; @@ -77,7 +95,8 @@ public override bool IsConnected(PlacedTileObject neighbourObject) // This is to avoid the wall considering there's 3 connections, because if it does, it takes // a L2 shape which allow to see through the wall. - if(TryGetOnLeftOrRightDoor(out PlacedTileObject door) && neighbourObject.GetComponent() != null) + if(TryGetOnLeftOrRightDoor(out PlacedTileObject door) + && neighbourObject.GetComponent() != null) { if (neighbourObject.IsInFront(door) || neighbourObject.IsBehind(door)) { diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs b/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs index e104c8053f..92161d4d30 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileConstants.cs @@ -4,8 +4,14 @@ namespace SS3D.Systems.Tile { + /// + /// File to easily access some tile related constants. + /// public static class TileConstants { + /// + /// length of a chunk in tiles. Chunks are made of ChunkSize * ChunkSize tiles. + /// public const int ChunkSize = 16; } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index bac5d6d31d..5661f08630 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -58,6 +58,11 @@ public static TileLayer[] GetTileLayers() return TileLayers; } + /// + /// Get the two adjacent directions from dir passed in parameter. + /// e.g if dir is North, return NorthWest and NorthEast. + /// + public static Tuple GetAdjacentDirections(Direction dir) { return new Tuple( (Direction) MathUtility.mod((int) dir + 1, 8), @@ -100,7 +105,7 @@ public static List CardinalDirections() } /// - /// Return a list of the cardinal directions. + /// Return a list of all existing directions. /// public static List AllDirections() { diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index 3c0b991833..4ab79ecefb 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -236,12 +236,20 @@ public void ClearTileObject(Vector3 placePosition, TileLayer layer) private void ResetAdjacencies(PlacedTileObject placed, TileObject location, List neighbours) { List neighboursAtDirection= new List(); + + // First get the directions of all neighbours, relative to this placed object. + // Direction is not always relevant (e.g disposal pipes with disposal furnitures) + // but it is in most cases. It's up to the connectors to choose what they do with this info. foreach (PlacedTileObject neighbour in neighbours) { placed.NeighbourAtDirectionOf(neighbour, out var dir); neighboursAtDirection.Add(dir); } + // then destroy this placed object. It's important to do it here, before updating + // adjacencies, as some connectors might be looking for it. location.ClearPlacedObject(); + + // Then update all neighbours, using their directions. int i = 0; foreach (PlacedTileObject neighbour in neighbours) { diff --git a/Assets/Scripts/SS3D/Utils/MathUtility.cs b/Assets/Scripts/SS3D/Utils/MathUtility.cs index b94222ae9b..a44af95f43 100644 --- a/Assets/Scripts/SS3D/Utils/MathUtility.cs +++ b/Assets/Scripts/SS3D/Utils/MathUtility.cs @@ -6,6 +6,12 @@ namespace SS3D.Utils { public static class MathUtility { + /// + /// Real modulus operation working with negative numbers as well. + /// e.g mod(-3,5) = 2. + /// This is necessary because % operator is not a modulus operation, + /// it would return -3 instead of 2. + /// public static int mod(int x, int m) { return (x % m + m) % m; From ab131dc882dc339332a346a77d9ed15571f5f092 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 2 Nov 2023 12:23:14 +0100 Subject: [PATCH 65/87] update disposal pipes generic type --- .../Resources/Structures/Pipes/Disposals/DisposalPipes.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Disposals/DisposalPipes.asset b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Disposals/DisposalPipes.asset index 6405acea4d..9cc04e3bf4 100644 --- a/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Disposals/DisposalPipes.asset +++ b/Assets/Content/Data/TileMap/Resources/Structures/Pipes/Disposals/DisposalPipes.asset @@ -16,7 +16,7 @@ MonoBehaviour: prefab: {fileID: 2802364579275783218, guid: 12a989ad41a83a3468d1ae9aff9628d3, type: 3} icon: {fileID: 0} layer: 3 - genericType: 0 + genericType: 14 specificType: 0 width: 1 height: 1 From 68a3caab5fe6d4165717389420f4a477e278acc7 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 6 Nov 2023 00:30:57 +0100 Subject: [PATCH 66/87] adapt code to multiple tile objects --- .../SS3D/Systems/Tile/CardinalTileLocation.cs | 5 ++ .../Connections/DisposalFurnitureConnector.cs | 3 +- .../DisposalPipeAdjacencyConnector.cs | 2 +- .../SS3D/Systems/Tile/ITileLocation.cs | 2 + .../SS3D/Systems/Tile/SingleTileLocation.cs | 6 ++ Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs | 7 ++- .../Scripts/SS3D/Systems/Tile/TileHelper.cs | 8 ++- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 57 ++++++++++--------- 8 files changed, 56 insertions(+), 34 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/CardinalTileLocation.cs b/Assets/Scripts/SS3D/Systems/Tile/CardinalTileLocation.cs index c3bdc7e615..df0aff9b84 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/CardinalTileLocation.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/CardinalTileLocation.cs @@ -127,5 +127,10 @@ private Direction IndexToDir(int i) { return (Direction) (i*2); } + + public List GetAllPlacedObject() + { + return _cardinalPlacedTileObject.Where(x => x!= null).ToList(); + } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs index b3b0402444..9b0e8f7718 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalFurnitureConnector.cs @@ -82,7 +82,8 @@ private bool TryGetPipeBelow(out PlacedTileObject pipe) var map = tileSystem.CurrentMap; TileChunk currentChunk = map.GetChunk(_placedObject.gameObject.transform.position); - var pipeLocation = currentChunk.GetTileObject(TileLayer.Disposal, _placedObject.Origin.x, _placedObject.Origin.y); + SingleTileLocation pipeLocation = (SingleTileLocation) currentChunk.GetTileLocation(TileLayer.Disposal, + _placedObject.Origin.x, _placedObject.Origin.y); pipe = pipeLocation.PlacedObject; return pipe != null; diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs index 46b038531e..68003037ee 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DisposalPipeAdjacencyConnector.cs @@ -160,7 +160,7 @@ private bool TryGetDisposalElementAbovePipe(out IDisposalElement disposalFurnitu var map = tileSystem.CurrentMap; TileChunk currentChunk = map.GetChunk(_placedObject.gameObject.transform.position); - var furnitureLocation = currentChunk.GetTileObject(TileLayer.FurnitureBase, _placedObject.Origin.x, _placedObject.Origin.y); + SingleTileLocation furnitureLocation = (SingleTileLocation) currentChunk.GetTileLocation(TileLayer.FurnitureBase, _placedObject.Origin.x, _placedObject.Origin.y); disposalFurniture = furnitureLocation.PlacedObject?.GetComponent(); return disposalFurniture != null; diff --git a/Assets/Scripts/SS3D/Systems/Tile/ITileLocation.cs b/Assets/Scripts/SS3D/Systems/Tile/ITileLocation.cs index 28e336d703..357dca0182 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/ITileLocation.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/ITileLocation.cs @@ -21,6 +21,8 @@ public TileLayer Layer /// public bool TryGetPlacedObject(out PlacedTileObject placedObject, Direction direction = Direction.North); + public List GetAllPlacedObject(); + /// /// Check if the tile is empty for a given direction. /// diff --git a/Assets/Scripts/SS3D/Systems/Tile/SingleTileLocation.cs b/Assets/Scripts/SS3D/Systems/Tile/SingleTileLocation.cs index 270ccfde34..5983b5d6d2 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/SingleTileLocation.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/SingleTileLocation.cs @@ -84,5 +84,11 @@ public void AddPlacedObject(PlacedTileObject tileObject, Direction direction = D { PlacedObject = tileObject; } + + public List GetAllPlacedObject() + { + return PlacedObject != null ? + new List { PlacedObject } : new List(); + } } } \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs b/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs index 9a3e24c99d..699582cd78 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileChunk.cs @@ -209,11 +209,12 @@ public List GetAllTilePlacedObjects() var list = new List(); foreach(TileGrid grid in _tileGridList) { - foreach(TileObject obj in grid.TileObjectsGrid) + foreach(ITileLocation location in grid.TileObjectsGrid) { - if(obj.PlacedObject != null) + + if(location != null) { - list.Add(obj.PlacedObject); + list.AddRange(location.GetAllPlacedObject()); } } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs index 1374fc4e5a..3f826da7a4 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileHelper.cs @@ -224,7 +224,13 @@ public static ITileLocation CreateTileLocation(TileLayer layer, int x, int y) return new SingleTileLocation(layer, x, y); case TileLayer.Disposal: return new SingleTileLocation(layer, x, y); - case TileLayer.Pipes: + case TileLayer.PipeSurface: + return new SingleTileLocation(layer, x, y); + case TileLayer.PipeMiddle: + return new SingleTileLocation(layer, x, y); + case TileLayer.PipeRight: + return new SingleTileLocation(layer, x, y); + case TileLayer.PipeLeft: return new SingleTileLocation(layer, x, y); case TileLayer.WallMountHigh: return new CardinalTileLocation(layer, x, y); diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index 3aac22a2c5..853406eb4d 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; +using static UnityEditor.FilePathAttribute; namespace SS3D.Systems.Tile { @@ -139,7 +140,7 @@ private ITileLocation[] GetTileLocations(Vector3 worldPosition) /// /// /// - private PlacedTileObject[] GetNeighbourPlacedObjects(TileLayer layer, Vector3 worldPosition) + public PlacedTileObject[] GetNeighbourPlacedObjects(TileLayer layer, Vector3 worldPosition) { PlacedTileObject[] adjacentObjects = new PlacedTileObject[8]; @@ -217,11 +218,9 @@ public bool PlaceTileObject(TileObjectSo tileObjectSo, Vector3 placePosition, Di public void ClearTileObject(Vector3 placePosition, TileLayer layer, Direction dir) { - TileObject[] tileObjects = GetTileObjects(placePosition); - TileObject tileObject = tileObjects[(int)layer]; - PlacedTileObject placed = tileObject.PlacedObject; ITileLocation[] tileObjects = GetTileLocations(placePosition); - tileObjects[(int)layer].TryClearPlacedObject(dir); + ITileLocation tileObject = tileObjects[(int)layer]; + tileObject.TryGetPlacedObject(out var placed, dir); if (placed != null && placed.TryGetComponent(out IAdjacencyConnector connector)) @@ -235,21 +234,22 @@ public void ClearTileObject(Vector3 placePosition, TileLayer layer, Direction di foreach (ITileLocation clearLocation in toClearLocations) { - placed = removeObject.PlacedObject; + var allPlaced = clearLocation.GetAllPlacedObject(); - if (placed != null && placed.TryGetComponent(out connector)) + foreach (PlacedTileObject placedToClear in allPlaced) { - List neighbours = connector.GetNeighbours(); - ResetAdjacencies(placed, removeObject, neighbours); + if (placed != null && placedToClear.TryGetComponent(out connector)) + { + List neighbours = connector.GetNeighbours(); + ResetAdjacencies(placed, clearLocation, neighbours); + } } - removeObject.ClearPlacedObject(); clearLocation.ClearAllPlacedObject(); - ResetAdjacencies(placePosition, clearLocation.Layer); } } - private void ResetAdjacencies(PlacedTileObject placed, TileObject location, List neighbours) + private void ResetAdjacencies(PlacedTileObject placed, ITileLocation location, List neighbours) { List neighboursAtDirection= new List(); @@ -263,7 +263,7 @@ private void ResetAdjacencies(PlacedTileObject placed, TileObject location, List } // then destroy this placed object. It's important to do it here, before updating // adjacencies, as some connectors might be looking for it. - location.ClearPlacedObject(); + location.ClearAllPlacedObject(); // Then update all neighbours, using their directions. int i = 0; @@ -345,11 +345,11 @@ public SavedTileMap Save() public void Load([CanBeNull] SavedTileMap saveObject) { - if (saveObject == null) - { + if (saveObject == null) + { Log.Warning(this, "The intended save object is null"); - return; - } + return; + } Clear(); @@ -362,24 +362,25 @@ public void Load([CanBeNull] SavedTileMap saveObject) foreach (var savedTile in savedTiles) { - foreach(SavedPlacedTileObject savedObject in savedTile.GetPlacedObjects()) + foreach (SavedPlacedTileObject savedObject in savedTile.GetPlacedObjects()) { TileObjectSo toBePlaced = (TileObjectSo)tileSystem.GetAsset(savedObject.tileObjectSOName); Vector3 placePosition = chunk.GetWorldPosition(savedTile.Location.x, savedTile.Location.y); - // Skipping build check here to allow loading tile objects in a non-valid order - PlaceTileObject(toBePlaced, placePosition, savedTile.placedSaveObject.dir, true, false, true); + // Skipping build check here to allow loading tile objects in a non-valid order + PlaceTileObject(toBePlaced, placePosition, savedObject.dir, true, false, true); + } } - } - foreach (SavedPlacedItemObject savedItem in saveObject.savedItemList) - { - ItemObjectSo toBePlaced = (ItemObjectSo)tileSystem.GetAsset(savedItem.itemName); - PlaceItemObject(savedItem.worldPosition, savedItem.rotation, toBePlaced); - } + foreach (SavedPlacedItemObject savedItem in saveObject.savedItemList) + { + ItemObjectSo toBePlaced = (ItemObjectSo)tileSystem.GetAsset(savedItem.itemName); + PlaceItemObject(savedItem.worldPosition, savedItem.rotation, toBePlaced); + } - OnMapLoaded?.Invoke(this, EventArgs.Empty); - UpdateAllAdjacencies(); + OnMapLoaded?.Invoke(this, EventArgs.Empty); + UpdateAllAdjacencies(); + } } /// From f7d06e4e9f01f619f1babb23e50c37c9a50b7323 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 6 Nov 2023 00:51:40 +0100 Subject: [PATCH 67/87] remove multi adjacency update some prefabs --- .../Generic/Surfaces/Tables/TableGlass.prefab | 95 ++++------ .../Generic/Surfaces/Tables/TableSteel.prefab | 95 ++++------ .../Structures/Floors/Plenum.prefab | 65 +------ .../Structures/Walls/SteelGirder.prefab | 51 ++--- .../Connections/MultiAdjacencyConnector.cs | 176 ------------------ .../MultiAdjacencyConnector.cs.meta | 11 -- 6 files changed, 102 insertions(+), 391 deletions(-) delete mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs delete mode 100644 Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs.meta diff --git a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableGlass.prefab b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableGlass.prefab index 9a0ca4726c..2311b988ec 100644 --- a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableGlass.prefab +++ b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableGlass.prefab @@ -12,8 +12,8 @@ GameObject: - component: {fileID: 1422391141370617402} - component: {fileID: 2885897057548802505} - component: {fileID: 8860121059280945640} - - component: {fileID: 7988096599566893515} - component: {fileID: 6244957436306937818} + - component: {fileID: 2130642872359250283} m_Layer: 0 m_Name: TableGlass m_TagString: Untagged @@ -100,7 +100,39 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1, y: 0.75, z: 1} m_Center: {x: 0, y: 0.375, z: 0} ---- !u!114 &7988096599566893515 +--- !u!114 &6244957436306937818 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2839728781945606427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0 + k__BackingField: {fileID: 0} + _networkBehaviours: [] + k__BackingField: {fileID: 0} + k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} + _isNetworked: 1 + _isGlobal: 0 + _initializeOrder: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: 65535 + k__BackingField: 0 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 10426574306644170534 +--- !u!114 &2130642872359250283 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -109,21 +141,14 @@ MonoBehaviour: m_GameObject: {fileID: 2839728781945606427} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + _componentIndexCache: 255 _addedNetworkObject: {fileID: 6244957436306937818} - _networkObjectCache: {fileID: 6244957436306937818} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: + _networkObjectCache: {fileID: 0} + _syncedConnections: 0 + advancedAdjacency: o: {fileID: -6474879442438147634, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} u: {fileID: -7482589699367499308, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} i: {fileID: -2157360573737795375, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} @@ -141,45 +166,3 @@ MonoBehaviour: xQuad: {fileID: 2518676867277241252, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 ---- !u!114 &6244957436306937818 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2839728781945606427} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} - m_Name: - m_EditorClassIdentifier: - k__BackingField: 0 - k__BackingField: 0 - _networkBehaviours: - - {fileID: 7988096599566893515} - k__BackingField: {fileID: 0} - k__BackingField: [] - _isNetworked: 1 - _isGlobal: 0 - _defaultDespawnType: 0 - NetworkObserver: {fileID: 0} - k__BackingField: -1 - _scenePathHash: 0 - k__BackingField: 0 - k__BackingField: 10426574306644170534 - _sceneNetworkObjects: [] diff --git a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableSteel.prefab b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableSteel.prefab index e3a409c7ab..d842833e6e 100644 --- a/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableSteel.prefab +++ b/Assets/Content/WorldObjects/Furniture/Generic/Surfaces/Tables/TableSteel.prefab @@ -12,8 +12,8 @@ GameObject: - component: {fileID: 6583449581753452249} - component: {fileID: 6984099654956712234} - component: {fileID: 3608857327747406091} - - component: {fileID: 3121066318499380073} - component: {fileID: 8635336608555116780} + - component: {fileID: 867590509919929168} m_Layer: 0 m_Name: TableSteel m_TagString: Untagged @@ -99,7 +99,39 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1, y: 0.75, z: 1} m_Center: {x: 0, y: 0.375, z: 0} ---- !u!114 &3121066318499380073 +--- !u!114 &8635336608555116780 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8036950609662249464} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 0 + k__BackingField: 0 + k__BackingField: {fileID: 0} + _networkBehaviours: [] + k__BackingField: {fileID: 0} + k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} + _isNetworked: 1 + _isGlobal: 0 + _initializeOrder: 0 + _defaultDespawnType: 0 + NetworkObserver: {fileID: 0} + k__BackingField: 65535 + k__BackingField: 0 + _scenePathHash: 0 + k__BackingField: 0 + k__BackingField: 10626543207120909748 +--- !u!114 &867590509919929168 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -108,21 +140,14 @@ MonoBehaviour: m_GameObject: {fileID: 8036950609662249464} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + _componentIndexCache: 255 _addedNetworkObject: {fileID: 8635336608555116780} - _networkObjectCache: {fileID: 8635336608555116780} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: + _networkObjectCache: {fileID: 0} + _syncedConnections: 0 + advancedAdjacency: o: {fileID: -6584651252408597845, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} u: {fileID: 1516601059846573687, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} i: {fileID: -7725530803512371161, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} @@ -140,45 +165,3 @@ MonoBehaviour: xQuad: {fileID: -7024319511112420413, guid: 32ccf9db762cc7c4f8f4af524e3e7ee7, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 ---- !u!114 &8635336608555116780 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8036950609662249464} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 26b716c41e9b56b4baafaf13a523ba2e, type: 3} - m_Name: - m_EditorClassIdentifier: - k__BackingField: 0 - k__BackingField: 0 - _networkBehaviours: - - {fileID: 3121066318499380073} - k__BackingField: {fileID: 0} - k__BackingField: [] - _isNetworked: 1 - _isGlobal: 0 - _defaultDespawnType: 0 - NetworkObserver: {fileID: 0} - k__BackingField: -1 - _scenePathHash: 0 - k__BackingField: 0 - k__BackingField: 10626543207120909748 - _sceneNetworkObjects: [] diff --git a/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab b/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab index ec0d9c7d4f..5ee1ccedf5 100644 --- a/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab +++ b/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab @@ -180,7 +180,6 @@ GameObject: - component: {fileID: 2586358896294450200} - component: {fileID: 5107901468329445811} - component: {fileID: 7564222845035831833} - - component: {fileID: -3175721348291802995} m_Layer: 0 m_Name: Plenum m_TagString: Untagged @@ -282,71 +281,21 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} k__BackingField: 16 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 1135847911748521981 - _sceneNetworkObjects: [] ---- !u!114 &-3175721348291802995 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8028539322119499722} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} - m_Name: - m_EditorClassIdentifier: - _componentIndexCache: 255 - _addedNetworkObject: {fileID: 7564222845035831833} - _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: - o: {fileID: -1186837388861869702, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - u: {fileID: 8670779871488701567, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - i: {fileID: 2136686312440598757, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - lNone: {fileID: 4400090147443950985, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - lSingle: {fileID: 4907585101989539511, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - tNone: {fileID: -5997185706695327500, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - tSingleRight: {fileID: -7342849457706584406, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - tSingleLeft: {fileID: -4854898696076092651, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - tDouble: {fileID: -53862880159183297, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - xNone: {fileID: 77848856100225938, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - xSingle: {fileID: -8966661648484664196, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - xSide: {fileID: -513754039711199066, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - xOpposite: {fileID: 6731330203905936185, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - xTriple: {fileID: 4104832187742309709, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - xQuad: {fileID: 2496505603022733099, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} - viewObstacles: [] - opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 diff --git a/Assets/Content/WorldObjects/Structures/Walls/SteelGirder.prefab b/Assets/Content/WorldObjects/Structures/Walls/SteelGirder.prefab index c4f4b82fe3..075f301621 100644 --- a/Assets/Content/WorldObjects/Structures/Walls/SteelGirder.prefab +++ b/Assets/Content/WorldObjects/Structures/Walls/SteelGirder.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 6696866361892651655} - component: {fileID: 7033236083530598125} - component: {fileID: -2900075557854325373} - - component: {fileID: 1492278076387892290} + - component: {fileID: 8380654261086022907} m_Layer: 0 m_Name: SteelGirder m_TagString: Untagged @@ -114,20 +114,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: - - {fileID: 1492278076387892290} + k__BackingField: {fileID: 0} + _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 10701242530576259807 - _sceneNetworkObjects: [] ---- !u!114 &1492278076387892290 +--- !u!114 &8380654261086022907 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -136,22 +141,15 @@ MonoBehaviour: m_GameObject: {fileID: 3591147544166670882} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + _componentIndexCache: 255 _addedNetworkObject: {fileID: -2900075557854325373} - _networkObjectCache: {fileID: -2900075557854325373} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} - _advancedAdjacency: - o: {fileID: -7104584066017280917, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} + _networkObjectCache: {fileID: 0} + _syncedConnections: 0 + advancedAdjacency: + o: {fileID: -3462111060628849216, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} u: {fileID: 2256514625206161274, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} i: {fileID: -8265987230191886290, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} lNone: {fileID: 8776228716606939545, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} @@ -168,18 +166,3 @@ MonoBehaviour: xQuad: {fileID: 4011312947144960823, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs deleted file mode 100644 index 79035fd415..0000000000 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs +++ /dev/null @@ -1,176 +0,0 @@ -using FishNet.Object; -using FishNet.Object.Synchronizing; -using SS3D.Core; -using SS3D.Logging; -using SS3D.Systems.Tile.Connections.AdjacencyTypes; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using UnityEngine.Serialization; - -namespace SS3D.Systems.Tile.Connections -{ - /// - /// Main adjacency connector class that should fulfill the majority of the use cases. This class ensures that similar objects will have their meshes seamlessly connect to each other. - /// - public class MultiAdjacencyConnector : NetworkBehaviour, IAdjacencyConnector - { - /// - /// Determines which adjacency type should be used. - /// - [FormerlySerializedAs("selectedAdjacencyType")] public AdjacencyType SelectedAdjacencyType; - - /// - /// A type that specifies to which objects to connect to. Must be set if cross connect is used. - /// - [Tooltip("Generic ID that adjacent objects must be to count. If empty, any id is accepted.")] - private TileObjectGenericType _genericType; - - /// - /// Specific ID to differentiate objects when the generic is the same. - /// - [Tooltip("Specific ID to differentiate objects when the generic is the same.")] - private TileObjectSpecificType _specificType; - - [FormerlySerializedAs("simpleAdjacency")] [SerializeField] private SimpleConnector _simpleAdjacency; - [FormerlySerializedAs("advancedAdjacency")] [SerializeField] private AdvancedConnector _advancedAdjacency; - [FormerlySerializedAs("offsetAdjacency")] [SerializeField] private OffsetConnector _offsetAdjacency; - - private AdjacencyMap _adjacencyMap; - - [SyncVar(OnChange = nameof(SyncAdjacencies))] - private byte _syncedConnections; - - private MeshFilter _filter; - private bool _initialized; - private PlacedTileObject _placedObject; - - public override void OnStartClient() - { - base.OnStartClient(); - Setup(); - } - - private void Setup() - { - if (!_initialized) - { - _adjacencyMap = new AdjacencyMap(); - _filter = GetComponent(); - - _placedObject = GetComponent(); - if (_placedObject == null) - { - _genericType = TileObjectGenericType.None; - _specificType = TileObjectSpecificType.None; - } - else - { - _genericType = _placedObject.GenericType; - _specificType = _placedObject.SpecificType; - } - _initialized = true; - } - } - - public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) - { - Setup(); - bool isConnected = false; - bool isUpdated = false; - - if (neighbourObject) - { - isConnected = (neighbourObject && neighbourObject.HasAdjacencyConnector); - isConnected &= neighbourObject.GenericType == _genericType || _genericType == TileObjectGenericType.None; - isConnected &= neighbourObject.SpecificType == _specificType || _specificType == TileObjectSpecificType.None; - - // Update our neighbour as well - if (isConnected && updateNeighbour) - neighbourObject.UpdateSingleAdjacency(TileHelper.GetOpposite(dir), _placedObject, false); - } - - isUpdated = _adjacencyMap.SetConnection(dir, new AdjacencyData(TileObjectGenericType.None, TileObjectSpecificType.None, isConnected)); - if (isUpdated) - { - _syncedConnections = _adjacencyMap.SerializeToByte(); - UpdateMeshAndDirection(); - } - - return isUpdated; - } - - public void UpdateAllConnections() - { - Setup(); - - var neighbourObjects = GetNeighbours(); - - bool changed = false; - foreach (var neighbourObject in neighbourObjects) - { - _placedObject.NeighbourAtDirectionOf(neighbourObject, out Direction dir); - changed |= UpdateSingleConnection(dir, neighbourObject, true); - } - - if (changed) - { - UpdateMeshAndDirection(); - } - } - - private void UpdateMeshAndDirection() - { - MeshDirectionInfo info = new(); - switch (SelectedAdjacencyType) - { - case AdjacencyType.Simple: - info = _simpleAdjacency.GetMeshAndDirection(_adjacencyMap); - break; - case AdjacencyType.Advanced: - info = _advancedAdjacency.GetMeshAndDirection(_adjacencyMap); - break; - case AdjacencyType.Offset: - info = _offsetAdjacency.GetMeshAndDirection(_adjacencyMap); - break; - } - - if (_filter == null) - { - Log.Warning(this, "Missing mesh {meshDirectionInfo}", Logs.Generic, info ); - } - - _filter.mesh = info.Mesh; - - Quaternion localRotation = transform.localRotation; - Vector3 eulerRotation = localRotation.eulerAngles; - localRotation = Quaternion.Euler(eulerRotation.x, info.Rotation, eulerRotation.z); - - transform.localRotation = localRotation; - } - - private void SyncAdjacencies(byte oldValue, byte newValue, bool asServer) - { - if (!asServer) - { - Setup(); - - _adjacencyMap.DeserializeFromByte(newValue); - UpdateMeshAndDirection(); - } - } - - public bool IsConnected(PlacedTileObject neighbourObject) - { - throw new System.NotImplementedException(); - } - - public List GetNeighbours() - { - TileSystem tileSystem = Subsystems.Get(); - var map = tileSystem.CurrentMap; - return map.GetNeighbourPlacedObjects(_placedObject.Layer, _placedObject.gameObject.transform.position).ToList(); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs.meta deleted file mode 100644 index 2715ec5d88..0000000000 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/MultiAdjacencyConnector.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 53a5cd0d46abb6d4d8686d11153009c2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From d9f33f862558868e0e4dbcc33fa7ee2fd6bddd48 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 6 Nov 2023 11:58:02 +0100 Subject: [PATCH 68/87] fix missing scripts --- .../Walls/SteelWallReinforced.prefab | 48 ++++++----------- .../Structures/Walls/SteelWindow.prefab | 47 ++++++---------- .../Walls/SteelWindowReinforced.prefab | 49 ++++++----------- .../Structures/Wires/Cables.prefab | 53 +++++-------------- 4 files changed, 60 insertions(+), 137 deletions(-) diff --git a/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab b/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab index 9e149af730..ac31c7c746 100644 --- a/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab +++ b/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab @@ -148,7 +148,7 @@ GameObject: - component: {fileID: 6696866361892651655} - component: {fileID: 7033236083530598125} - component: {fileID: -2900075557854325373} - - component: {fileID: 1492278076387892290} + - component: {fileID: 3011383631706744183} m_Layer: 0 m_Name: SteelWallReinforced m_TagString: Untagged @@ -253,20 +253,26 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: - - {fileID: 1492278076387892290} + - {fileID: 0} k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 15843822419293565003 - _sceneNetworkObjects: [] ---- !u!114 &1492278076387892290 +--- !u!114 &3011383631706744183 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -275,20 +281,13 @@ MonoBehaviour: m_GameObject: {fileID: 3591147544166670882} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: d3995769f8fecf9469d1783a30e75625, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + _componentIndexCache: 255 _addedNetworkObject: {fileID: -2900075557854325373} - _networkObjectCache: {fileID: -2900075557854325373} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} + _networkObjectCache: {fileID: 0} + _syncedConnections: 0 _advancedAdjacency: o: {fileID: -3335109427502187752, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} u: {fileID: -4617469110243651000, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} @@ -304,24 +303,9 @@ MonoBehaviour: xSide: {fileID: 9163509131738271192, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xOpposite: {fileID: -7744038958267161825, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xTriple: {fileID: 5869884649093938551, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} - xQuad: {fileID: 4199670461815796357, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} + xQuad: {fileID: 5869884649093938551, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 --- !u!1 &7790124558541205835 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Content/WorldObjects/Structures/Walls/SteelWindow.prefab b/Assets/Content/WorldObjects/Structures/Walls/SteelWindow.prefab index 7b8a60ea91..abaf37e009 100644 --- a/Assets/Content/WorldObjects/Structures/Walls/SteelWindow.prefab +++ b/Assets/Content/WorldObjects/Structures/Walls/SteelWindow.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 6696866361892651655} - component: {fileID: 7033236083530598125} - component: {fileID: -2900075557854325373} - - component: {fileID: 1492278076387892290} + - component: {fileID: 1177000688717996335} m_Layer: 0 m_Name: SteelWindow m_TagString: Untagged @@ -115,20 +115,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: - - {fileID: 1492278076387892290} + k__BackingField: {fileID: 0} + _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 17271989988591409099 - _sceneNetworkObjects: [] ---- !u!114 &1492278076387892290 +--- !u!114 &1177000688717996335 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -137,20 +142,13 @@ MonoBehaviour: m_GameObject: {fileID: 3591147544166670882} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: d3995769f8fecf9469d1783a30e75625, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + _componentIndexCache: 255 _addedNetworkObject: {fileID: -2900075557854325373} - _networkObjectCache: {fileID: -2900075557854325373} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} + _networkObjectCache: {fileID: 0} + _syncedConnections: 0 _advancedAdjacency: o: {fileID: 3274458310347382516, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} u: {fileID: -2386277492448864069, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} @@ -169,18 +167,3 @@ MonoBehaviour: xQuad: {fileID: -4646627001110862441, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 diff --git a/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab b/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab index 65990661f6..623f0fe5eb 100644 --- a/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab +++ b/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 6696866361892651655} - component: {fileID: 7033236083530598125} - component: {fileID: -2900075557854325373} - - component: {fileID: 1492278076387892290} + - component: {fileID: 4137545864262984256} m_Layer: 0 m_Name: SteelWindowReinforced m_TagString: Untagged @@ -115,20 +115,25 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 - _networkBehaviours: - - {fileID: 1492278076387892290} + k__BackingField: {fileID: 0} + _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 2644125336701811203 - _sceneNetworkObjects: [] ---- !u!114 &1492278076387892290 +--- !u!114 &4137545864262984256 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -137,20 +142,13 @@ MonoBehaviour: m_GameObject: {fileID: 3591147544166670882} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: d3995769f8fecf9469d1783a30e75625, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 0 + _componentIndexCache: 255 _addedNetworkObject: {fileID: -2900075557854325373} - _networkObjectCache: {fileID: -2900075557854325373} - SelectedAdjacencyType: 1 - _simpleAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - l: {fileID: 0} - t: {fileID: 0} - x: {fileID: 0} + _networkObjectCache: {fileID: 0} + _syncedConnections: 0 _advancedAdjacency: o: {fileID: 2802706056601887283, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} u: {fileID: 5076968874085622753, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} @@ -166,21 +164,6 @@ MonoBehaviour: xSide: {fileID: 791389691363571250, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xOpposite: {fileID: -8791185763750810588, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xTriple: {fileID: -4842746724093398965, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} - xQuad: {fileID: -4646627001110862441, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} + xQuad: {fileID: -4842746724093398965, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} viewObstacles: [] opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 diff --git a/Assets/Content/WorldObjects/Structures/Wires/Cables.prefab b/Assets/Content/WorldObjects/Structures/Wires/Cables.prefab index 35e53b0d95..8242d02bab 100644 --- a/Assets/Content/WorldObjects/Structures/Wires/Cables.prefab +++ b/Assets/Content/WorldObjects/Structures/Wires/Cables.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: -7727686409064562107} - component: {fileID: -1074477776341974781} - component: {fileID: -4998431523760016775} - - component: {fileID: -3462450205292552653} + - component: {fileID: 687402633161505411} m_Layer: 0 m_Name: Cables m_TagString: Untagged @@ -49,18 +49,24 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: 0 k__BackingField: 0 + k__BackingField: {fileID: 0} _networkBehaviours: [] k__BackingField: {fileID: 0} k__BackingField: [] + SerializedTransformProperties: + Position: {x: 0, y: 0, z: 0} + Rotation: {x: 0, y: 0, z: 0, w: 0} + LocalScale: {x: 0, y: 0, z: 0} _isNetworked: 1 _isGlobal: 0 + _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: -1 + k__BackingField: 65535 + k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 k__BackingField: 18187315780351828922 - _sceneNetworkObjects: [] --- !u!33 &-1074477776341974781 MeshFilter: m_ObjectHideFlags: 0 @@ -111,7 +117,7 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &-3462450205292552653 +--- !u!114 &687402633161505411 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -120,50 +126,17 @@ MonoBehaviour: m_GameObject: {fileID: 2802364579275783218} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 53a5cd0d46abb6d4d8686d11153009c2, type: 3} + m_Script: {fileID: 11500000, guid: bc6615260753fbd48af09343d5d55332, type: 3} m_Name: m_EditorClassIdentifier: _componentIndexCache: 255 _addedNetworkObject: {fileID: -7727686409064562107} _networkObjectCache: {fileID: 0} - SelectedAdjacencyType: 0 - _simpleAdjacency: + _syncedConnections: 0 + simpleAdjacency: o: {fileID: -8711453034529356013, guid: 3e69413026bf051418bf84fec0ce5919, type: 3} u: {fileID: -1590738978952025886, guid: 3e69413026bf051418bf84fec0ce5919, type: 3} i: {fileID: -2043613833257120371, guid: 3e69413026bf051418bf84fec0ce5919, type: 3} l: {fileID: -9081922812702010850, guid: 3e69413026bf051418bf84fec0ce5919, type: 3} t: {fileID: -5358326586770029455, guid: 3e69413026bf051418bf84fec0ce5919, type: 3} x: {fileID: -8228826546953468662, guid: 3e69413026bf051418bf84fec0ce5919, type: 3} - _advancedAdjacency: - o: {fileID: 0} - u: {fileID: 0} - i: {fileID: 0} - lNone: {fileID: 0} - lSingle: {fileID: 0} - tNone: {fileID: 0} - tSingleRight: {fileID: 0} - tSingleLeft: {fileID: 0} - tDouble: {fileID: 0} - xNone: {fileID: 0} - xSingle: {fileID: 0} - xSide: {fileID: 0} - xOpposite: {fileID: 0} - xTriple: {fileID: 0} - xQuad: {fileID: 0} - viewObstacles: [] - opaque: 0 - _offsetAdjacency: - o: {fileID: 0} - uNorth: {fileID: 0} - uSouth: {fileID: 0} - i: {fileID: 0} - lNE: {fileID: 0} - lNW: {fileID: 0} - lSE: {fileID: 0} - lSW: {fileID: 0} - tNEW: {fileID: 0} - tNSW: {fileID: 0} - tNSE: {fileID: 0} - tSWE: {fileID: 0} - x: {fileID: 0} - _syncedConnections: 0 From 178bb639ff6b1ed696b3507001fef7f5c5a2c0a4 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 6 Nov 2023 12:53:21 +0100 Subject: [PATCH 69/87] fix build --- Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index 853406eb4d..35126aa151 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; -using static UnityEditor.FilePathAttribute; namespace SS3D.Systems.Tile { From 76812b9044a5eca775c957ccbe7d6812a0bf4b92 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 9 Nov 2023 11:12:30 +0100 Subject: [PATCH 70/87] added x6 from steelwall for steelwall reinforced --- .../Structures/Walls/SteelWallReinforced.prefab | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab b/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab index ac31c7c746..649e52f90d 100644 --- a/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab +++ b/Assets/Content/WorldObjects/Structures/Walls/SteelWallReinforced.prefab @@ -255,7 +255,7 @@ MonoBehaviour: k__BackingField: 0 k__BackingField: {fileID: 0} _networkBehaviours: - - {fileID: 0} + - {fileID: 3011383631706744183} k__BackingField: {fileID: 0} k__BackingField: [] SerializedTransformProperties: @@ -267,7 +267,7 @@ MonoBehaviour: _initializeOrder: 0 _defaultDespawnType: 0 NetworkObserver: {fileID: 0} - k__BackingField: 65535 + k__BackingField: 138 k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 @@ -284,9 +284,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d3995769f8fecf9469d1783a30e75625, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 255 + _componentIndexCache: 0 _addedNetworkObject: {fileID: -2900075557854325373} - _networkObjectCache: {fileID: 0} + _networkObjectCache: {fileID: -2900075557854325373} _syncedConnections: 0 _advancedAdjacency: o: {fileID: -3335109427502187752, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} @@ -303,7 +303,7 @@ MonoBehaviour: xSide: {fileID: 9163509131738271192, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xOpposite: {fileID: -7744038958267161825, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xTriple: {fileID: 5869884649093938551, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} - xQuad: {fileID: 5869884649093938551, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} + xQuad: {fileID: 4199670461815796357, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} viewObstacles: [] opaque: 0 --- !u!1 &7790124558541205835 From b9d183b18c32dddc4869a02905a521e7e3d2ea04 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 9 Nov 2023 11:18:43 +0100 Subject: [PATCH 71/87] fix plenum ? --- .../Structures/Floors/Plenum.prefab | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab b/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab index 5ee1ccedf5..8118b0f5dc 100644 --- a/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab +++ b/Assets/Content/WorldObjects/Structures/Floors/Plenum.prefab @@ -180,6 +180,7 @@ GameObject: - component: {fileID: 2586358896294450200} - component: {fileID: 5107901468329445811} - component: {fileID: 7564222845035831833} + - component: {fileID: 9057318044260736153} m_Layer: 0 m_Name: Plenum m_TagString: Untagged @@ -299,3 +300,37 @@ MonoBehaviour: _scenePathHash: 0 k__BackingField: 0 k__BackingField: 1135847911748521981 +--- !u!114 &9057318044260736153 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8028539322119499722} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ef4340642b9b436498fe733f9329ac87, type: 3} + m_Name: + m_EditorClassIdentifier: + _componentIndexCache: 255 + _addedNetworkObject: {fileID: 7564222845035831833} + _networkObjectCache: {fileID: 0} + _syncedConnections: 0 + advancedAdjacency: + o: {fileID: -1186837388861869702, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + u: {fileID: 8670779871488701567, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + i: {fileID: 2136686312440598757, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + lNone: {fileID: 4400090147443950985, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + lSingle: {fileID: 4907585101989539511, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + tNone: {fileID: -5997185706695327500, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + tSingleRight: {fileID: -7342849457706584406, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + tSingleLeft: {fileID: -4854898696076092651, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + tDouble: {fileID: -53862880159183297, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + xNone: {fileID: 77848856100225938, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + xSingle: {fileID: -8966661648484664196, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + xSide: {fileID: -513754039711199066, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + xOpposite: {fileID: 6731330203905936185, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + xTriple: {fileID: 4104832187742309709, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + xQuad: {fileID: 2496505603022733099, guid: 4c8857a063a69ee4b8abb5e9e668b2bf, type: 3} + viewObstacles: [] + opaque: 0 From 8f1825b89c6cce3b5f158e4a228bdabbad85b8c9 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 9 Nov 2023 21:12:41 +0100 Subject: [PATCH 72/87] fix indentation --- .../Tile/TileMapCreator/TileMapCreator.cs | 892 +++++++++--------- 1 file changed, 446 insertions(+), 446 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs index 57b79ea374..f6d896064a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs @@ -1,4 +1,4 @@ -using Coimbra; +using Coimbra; using DynamicPanels; using FishNet.Connection; using FishNet.Object; @@ -17,262 +17,262 @@ namespace SS3D.Systems.Tile.TileMapCreator { - /// - /// In-game editor for placing and deleting items/objects in a tilemap. - /// - public class TileMapCreator : NetworkSystem, IPointerEnterHandler, IPointerExitHandler - { - public GameObject _menuRoot; - public GameObject _contentRoot; - public GameObject _slotPrefab; - public TMP_Dropdown _layerPlacementDropdown; - - private bool _enabled = false; - private bool _initalized = false; - private bool _isDeleting = false; - private bool _itemPlacement = false; - private bool _mouseOverUI = false; - - private Vector3 _lastSnappedPosition; - private GenericObjectSo _selectedObject; - - private TileSystem _tileSystem; - private GhostManager _ghostManager; - private Plane _plane; - - private List _objectDatabase; - private Controls.TileCreatorActions _controls; - private InputSystem _inputSystem; + /// + /// In-game editor for placing and deleting items/objects in a tilemap. + /// + public class TileMapCreator : NetworkSystem, IPointerEnterHandler, IPointerExitHandler + { + public GameObject _menuRoot; + public GameObject _contentRoot; + public GameObject _slotPrefab; + public TMP_Dropdown _layerPlacementDropdown; + + private bool _enabled = false; + private bool _initalized = false; + private bool _isDeleting = false; + private bool _itemPlacement = false; + private bool _mouseOverUI = false; + + private Vector3 _lastSnappedPosition; + private GenericObjectSo _selectedObject; + + private TileSystem _tileSystem; + private GhostManager _ghostManager; + private Plane _plane; + + private List _objectDatabase; + private Controls.TileCreatorActions _controls; + private InputSystem _inputSystem; private PanelTab _tab; - public bool IsDeleting - { - get => _isDeleting; - set - { - if (_selectedObject == null) - { - return; - } - - _isDeleting = value; - RefreshGhost(); - } - } - - [ServerOrClient] - protected override void OnStart() - { - base.OnStart(); + public bool IsDeleting + { + get => _isDeleting; + set + { + if (_selectedObject == null) + { + return; + } + + _isDeleting = value; + RefreshGhost(); + } + } + + [ServerOrClient] + protected override void OnStart() + { + base.OnStart(); _tab = PanelUtils.GetAssociatedTab(GetComponent()); ShowUI(false); _inputSystem = Subsystems.Get(); - _controls = _inputSystem.Inputs.TileCreator; - _inputSystem.ToggleAction(_controls.ToggleMenu, true); + _controls = _inputSystem.Inputs.TileCreator; + _inputSystem.ToggleAction(_controls.ToggleMenu, true); _controls.ToggleMenu.performed += HandleToggleMenu; - _controls.Replace.performed += HandleReplace; - _controls.Replace.canceled += HandleReplace; - _controls.Place.performed += HandlePlace; - _controls.Rotate.performed += HandleRotate; + _controls.Replace.performed += HandleReplace; + _controls.Replace.canceled += HandleReplace; + _controls.Place.performed += HandlePlace; + _controls.Rotate.performed += HandleRotate; - } - - private void HandleToggleMenu(InputAction.CallbackContext context) - { - if (_enabled) - { - _inputSystem.ToggleActionMap(_controls, false, new[] - { - _controls.ToggleMenu - }); - - _inputSystem.ToggleCollisions(_controls, true); - } - else - { - _inputSystem.ToggleActionMap(_controls, true, new[] - { - _controls.ToggleMenu - }); - - _inputSystem.ToggleCollisions(_controls, false); - } - - _enabled = !_enabled; - ShowUI(_enabled); - Initialize(); - } - - private void HandleRotate(InputAction.CallbackContext context) - { - _ghostManager.SetNextRotation(); - RefreshGhost(); - } - - private void HandleReplace(InputAction.CallbackContext context) - { - RefreshGhost(); - } - - private void HandlePlace(InputAction.CallbackContext context) - { - if (_mouseOverUI) - { - return; - } - - HandleMouseClick(_lastSnappedPosition, _controls.Replace.phase == InputActionPhase.Performed); - } - - [ServerOrClient] - private void Initialize() - { - if (_initalized) - { - return; - } - - _tileSystem = Subsystems.Get(); - _ghostManager = GetComponent(); - _plane = new Plane(Vector3.up, 0); - - LoadObjectGrid(new[] - { - TileLayer.Plenum - }, false); - - _initalized = true; - } - - [ServerOrClient] - private void Update() - { - if (!_initalized) - { - return; - } - // Clean-up if we are not building - if (_selectedObject == null) - { + } + + private void HandleToggleMenu(InputAction.CallbackContext context) + { + if (_enabled) + { + _inputSystem.ToggleActionMap(_controls, false, new[] + { + _controls.ToggleMenu + }); + + _inputSystem.ToggleCollisions(_controls, true); + } + else + { + _inputSystem.ToggleActionMap(_controls, true, new[] + { + _controls.ToggleMenu + }); + + _inputSystem.ToggleCollisions(_controls, false); + } + + _enabled = !_enabled; + ShowUI(_enabled); + Initialize(); + } + + private void HandleRotate(InputAction.CallbackContext context) + { + _ghostManager.SetNextRotation(); + RefreshGhost(); + } + + private void HandleReplace(InputAction.CallbackContext context) + { + RefreshGhost(); + } + + private void HandlePlace(InputAction.CallbackContext context) + { + if (_mouseOverUI) + { + return; + } + + HandleMouseClick(_lastSnappedPosition, _controls.Replace.phase == InputActionPhase.Performed); + } + + [ServerOrClient] + private void Initialize() + { + if (_initalized) + { + return; + } + + _tileSystem = Subsystems.Get(); + _ghostManager = GetComponent(); + _plane = new Plane(Vector3.up, 0); + + LoadObjectGrid(new[] + { + TileLayer.Plenum + }, false); + + _initalized = true; + } + + [ServerOrClient] + private void Update() + { + if (!_initalized) + { + return; + } + // Clean-up if we are not building + if (_selectedObject == null) + { _ghostManager.DestroyGhost(); return; - } - - _ghostManager.CreateGhost(_selectedObject.prefab); - - // Check if mouse moved - Vector3 snappedPosition = TileHelper.GetClosestPosition(GetMousePosition()); - - if (snappedPosition != _lastSnappedPosition && !_itemPlacement) - { - _ghostManager.SetTargetPosition(snappedPosition); - _lastSnappedPosition = snappedPosition; - RefreshGhost(); - } - - if (_itemPlacement) - { - Vector3 newPosition = GetMousePosition(); - _ghostManager.SetTargetPosition(newPosition); - _lastSnappedPosition = newPosition; - } - - _ghostManager.MoveGhost(); - } - - [ServerOrClient] - private void HandleMouseClick(Vector3 snappedPosition, bool replaceExisting) - { - if (_isDeleting) - { - if (_itemPlacement) - { - FindAndDeleteItem(snappedPosition); - } - else - { - _tileSystem.RpcClearTileObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir); - } - } - else - { - if (_selectedObject == null) - { - return; - } - - _tileSystem.RpcPlaceObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir, replaceExisting); - RefreshGhost(); - } - } - - [ServerOrClient] - private void FindAndDeleteItem(Vector3 worldPosition) - { - Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - - if (Physics.Raycast(ray, out RaycastHit hitInfo)) - { - PlacedItemObject placedItem = hitInfo.collider.gameObject.GetComponent(); - - if (placedItem != null) - { - _tileSystem.RpcClearItemObject(placedItem.NameString, worldPosition); - } - } - } - - [ServerOrClient] - private Vector3 GetMousePosition() - { - Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - - if (_plane.Raycast(ray, out float distance)) - { - return ray.GetPoint(distance); - } - - return Vector3.zero; - } - - [ServerOrClient] - private void CheckBuildValidity(Vector3 placePosition, bool replaceExisting) - { - RpcSendCanBuild(_selectedObject.nameString, placePosition, _ghostManager.Dir, replaceExisting, LocalConnection); - } - - // Ownership not required since a client can request whether it is possible to build - [Client] - [ServerRpc(RequireOwnership = false)] - public void RpcSendCanBuild(string tileObjectSoName, Vector3 placePosition, Direction dir, bool replaceExisting, NetworkConnection conn) - { - if (_tileSystem == null) - { - _tileSystem = Subsystems.Get(); - } - - TileObjectSo tileObjectSo = (TileObjectSo)_tileSystem.GetAsset(tileObjectSoName); - - if (tileObjectSo == null) - { - return; - } - - bool canBuild = _tileSystem.CanBuild(tileObjectSo, placePosition, dir, replaceExisting); - RpcReceiveCanBuild(conn, canBuild); - } - - [Client] - [TargetRpc] - private void RpcReceiveCanBuild(NetworkConnection conn, bool canBuild) - { - _ghostManager.ChangeGhostColor(canBuild ? GhostManager.BuildMatMode.Valid : GhostManager.BuildMatMode.Invalid); - } - - [ServerOrClient] - private void ShowUI(bool show) - { + } + + _ghostManager.CreateGhost(_selectedObject.prefab); + + // Check if mouse moved + Vector3 snappedPosition = TileHelper.GetClosestPosition(GetMousePosition()); + + if (snappedPosition != _lastSnappedPosition && !_itemPlacement) + { + _ghostManager.SetTargetPosition(snappedPosition); + _lastSnappedPosition = snappedPosition; + RefreshGhost(); + } + + if (_itemPlacement) + { + Vector3 newPosition = GetMousePosition(); + _ghostManager.SetTargetPosition(newPosition); + _lastSnappedPosition = newPosition; + } + + _ghostManager.MoveGhost(); + } + + [ServerOrClient] + private void HandleMouseClick(Vector3 snappedPosition, bool replaceExisting) + { + if (_isDeleting) + { + if (_itemPlacement) + { + FindAndDeleteItem(snappedPosition); + } + else + { + _tileSystem.RpcClearTileObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir); + } + } + else + { + if (_selectedObject == null) + { + return; + } + + _tileSystem.RpcPlaceObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir, replaceExisting); + RefreshGhost(); + } + } + + [ServerOrClient] + private void FindAndDeleteItem(Vector3 worldPosition) + { + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + + if (Physics.Raycast(ray, out RaycastHit hitInfo)) + { + PlacedItemObject placedItem = hitInfo.collider.gameObject.GetComponent(); + + if (placedItem != null) + { + _tileSystem.RpcClearItemObject(placedItem.NameString, worldPosition); + } + } + } + + [ServerOrClient] + private Vector3 GetMousePosition() + { + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + + if (_plane.Raycast(ray, out float distance)) + { + return ray.GetPoint(distance); + } + + return Vector3.zero; + } + + [ServerOrClient] + private void CheckBuildValidity(Vector3 placePosition, bool replaceExisting) + { + RpcSendCanBuild(_selectedObject.nameString, placePosition, _ghostManager.Dir, replaceExisting, LocalConnection); + } + + // Ownership not required since a client can request whether it is possible to build + [Client] + [ServerRpc(RequireOwnership = false)] + public void RpcSendCanBuild(string tileObjectSoName, Vector3 placePosition, Direction dir, bool replaceExisting, NetworkConnection conn) + { + if (_tileSystem == null) + { + _tileSystem = Subsystems.Get(); + } + + TileObjectSo tileObjectSo = (TileObjectSo)_tileSystem.GetAsset(tileObjectSoName); + + if (tileObjectSo == null) + { + return; + } + + bool canBuild = _tileSystem.CanBuild(tileObjectSo, placePosition, dir, replaceExisting); + RpcReceiveCanBuild(conn, canBuild); + } + + [Client] + [TargetRpc] + private void RpcReceiveCanBuild(NetworkConnection conn, bool canBuild) + { + _ghostManager.ChangeGhostColor(canBuild ? GhostManager.BuildMatMode.Valid : GhostManager.BuildMatMode.Invalid); + } + + [ServerOrClient] + private void ShowUI(bool show) + { if (!show) { if (_ghostManager) @@ -282,206 +282,206 @@ private void ShowUI(bool show) _tab.Detach(); } _tab.Panel.gameObject.SetActive(show); - _menuRoot.SetActive(show); - } - - /// - /// Loads a list of tile objects and places them in the UI box grid. - /// - /// - /// - [ServerOrClient] - private void LoadObjectGrid(TileLayer[] allowedLayers, bool isItems) - { - ClearGrid(); - - _objectDatabase = _tileSystem.Loader.Assets; - - foreach (GenericObjectSo asset in _objectDatabase) - { - switch (isItems) - { - case true when asset is not ItemObjectSo: - case false when asset is ItemObjectSo: - case false when asset is TileObjectSo so && !allowedLayers.Contains(so.layer): - continue; - } - - GameObject slot = Instantiate(_slotPrefab, _contentRoot.transform, true); - - TileMapCreatorTab tab = slot.AddComponent(); - - tab.Setup(asset); - } - } - - [ServerOrClient] - private void ClearGrid() - { - for (int i = 0; i < _contentRoot.transform.childCount; i++) - { - _contentRoot.transform.GetChild(i).gameObject.Dispose(true); - } - } - - [ServerOrClient] - private void RefreshGhost() - { - if (_selectedObject == null) - { - return; - } - - if (_isDeleting) - { - _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Deleting); - } - else - { - switch (_itemPlacement) - { - case true: - _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Valid); - - break; - case false when _controls.Replace.phase == InputActionPhase.Performed: - CheckBuildValidity(_lastSnappedPosition, true); - - break; - case false: - CheckBuildValidity(_lastSnappedPosition, false); - - break; - } - } - } - - [ServerOrClient] - public void SetSelectedObject(GenericObjectSo genericObjectSo) - { - _itemPlacement = genericObjectSo switch - { - TileObjectSo => false, - ItemObjectSo => true, - _ => _itemPlacement, - }; - - _selectedObject = genericObjectSo; - _ghostManager.DestroyGhost(); - _ghostManager.CreateGhost(genericObjectSo.prefab); - - RefreshGhost(); - } - - [Server] - public void LoadMap() - { - if (IsServer) - { - _tileSystem.Load(); - } - else - { - Log.Information(this, "Cannot load the map on a client"); - } - } - - [Server] - public void SaveMap() - { - if (IsServer) - { - _tileSystem.Save(); - } - else - { - Log.Information(this, "Cannot save the map on a client"); - } - } - - - /// - /// Change the currently displayed tiles/items when a new layer is selected in the drop down menu. - /// - [ServerOrClient] - public void OnDropDownChange() - { - int index = _layerPlacementDropdown.value; - - switch (index) - { - case 0: - LoadObjectGrid(new[] - { - TileLayer.Plenum - }, false); - - break; - case 1: - LoadObjectGrid(new[] - { - TileLayer.Turf - }, false); - - break; - case 2: - LoadObjectGrid(new[] - { - TileLayer.FurnitureBase, - TileLayer.FurnitureTop - }, false); - - break; - case 3: - LoadObjectGrid(new[] - { - TileLayer.WallMountHigh, - TileLayer.WallMountLow - }, false); - - break; - case 4: - LoadObjectGrid(new[] - { - TileLayer.Wire, - TileLayer.Disposal, - TileLayer.PipeLeft, + _menuRoot.SetActive(show); + } + + /// + /// Loads a list of tile objects and places them in the UI box grid. + /// + /// + /// + [ServerOrClient] + private void LoadObjectGrid(TileLayer[] allowedLayers, bool isItems) + { + ClearGrid(); + + _objectDatabase = _tileSystem.Loader.Assets; + + foreach (GenericObjectSo asset in _objectDatabase) + { + switch (isItems) + { + case true when asset is not ItemObjectSo: + case false when asset is ItemObjectSo: + case false when asset is TileObjectSo so && !allowedLayers.Contains(so.layer): + continue; + } + + GameObject slot = Instantiate(_slotPrefab, _contentRoot.transform, true); + + TileMapCreatorTab tab = slot.AddComponent(); + + tab.Setup(asset); + } + } + + [ServerOrClient] + private void ClearGrid() + { + for (int i = 0; i < _contentRoot.transform.childCount; i++) + { + _contentRoot.transform.GetChild(i).gameObject.Dispose(true); + } + } + + [ServerOrClient] + private void RefreshGhost() + { + if (_selectedObject == null) + { + return; + } + + if (_isDeleting) + { + _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Deleting); + } + else + { + switch (_itemPlacement) + { + case true: + _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Valid); + + break; + case false when _controls.Replace.phase == InputActionPhase.Performed: + CheckBuildValidity(_lastSnappedPosition, true); + + break; + case false: + CheckBuildValidity(_lastSnappedPosition, false); + + break; + } + } + } + + [ServerOrClient] + public void SetSelectedObject(GenericObjectSo genericObjectSo) + { + _itemPlacement = genericObjectSo switch + { + TileObjectSo => false, + ItemObjectSo => true, + _ => _itemPlacement, + }; + + _selectedObject = genericObjectSo; + _ghostManager.DestroyGhost(); + _ghostManager.CreateGhost(genericObjectSo.prefab); + + RefreshGhost(); + } + + [Server] + public void LoadMap() + { + if (IsServer) + { + _tileSystem.Load(); + } + else + { + Log.Information(this, "Cannot load the map on a client"); + } + } + + [Server] + public void SaveMap() + { + if (IsServer) + { + _tileSystem.Save(); + } + else + { + Log.Information(this, "Cannot save the map on a client"); + } + } + + + /// + /// Change the currently displayed tiles/items when a new layer is selected in the drop down menu. + /// + [ServerOrClient] + public void OnDropDownChange() + { + int index = _layerPlacementDropdown.value; + + switch (index) + { + case 0: + LoadObjectGrid(new[] + { + TileLayer.Plenum + }, false); + + break; + case 1: + LoadObjectGrid(new[] + { + TileLayer.Turf + }, false); + + break; + case 2: + LoadObjectGrid(new[] + { + TileLayer.FurnitureBase, + TileLayer.FurnitureTop + }, false); + + break; + case 3: + LoadObjectGrid(new[] + { + TileLayer.WallMountHigh, + TileLayer.WallMountLow + }, false); + + break; + case 4: + LoadObjectGrid(new[] + { + TileLayer.Wire, + TileLayer.Disposal, + TileLayer.PipeLeft, TileLayer.PipeRight, TileLayer.PipeSurface, TileLayer.PipeMiddle - }, false); - - break; - case 5: - LoadObjectGrid(new[] - { - TileLayer.Overlays - }, false); - - break; - case 6: - LoadObjectGrid(null, true); - - break; - default: - ClearGrid(); - - break; - } - } - - [ServerOrClient] - public void OnPointerEnter(PointerEventData eventData) - { - _mouseOverUI = true; - Subsystems.Get().ToggleBinding("/scroll/y", false); - } - - [ServerOrClient] - public void OnPointerExit(PointerEventData eventData) - { - _mouseOverUI = false; - Subsystems.Get().ToggleBinding("/scroll/y", true); - } - } + }, false); + + break; + case 5: + LoadObjectGrid(new[] + { + TileLayer.Overlays + }, false); + + break; + case 6: + LoadObjectGrid(null, true); + + break; + default: + ClearGrid(); + + break; + } + } + + [ServerOrClient] + public void OnPointerEnter(PointerEventData eventData) + { + _mouseOverUI = true; + Subsystems.Get().ToggleBinding("/scroll/y", false); + } + + [ServerOrClient] + public void OnPointerExit(PointerEventData eventData) + { + _mouseOverUI = false; + Subsystems.Get().ToggleBinding("/scroll/y", true); + } + } } \ No newline at end of file From 5113da9e6c4a02dc77957409bdccd9060243f0b5 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 9 Nov 2023 21:13:55 +0100 Subject: [PATCH 73/87] fix X6 for reinforced steel windows --- .../WorldObjects/Structures/Walls/SteelWindowReinforced.prefab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab b/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab index 623f0fe5eb..ce71447fd9 100644 --- a/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab +++ b/Assets/Content/WorldObjects/Structures/Walls/SteelWindowReinforced.prefab @@ -164,6 +164,6 @@ MonoBehaviour: xSide: {fileID: 791389691363571250, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xOpposite: {fileID: -8791185763750810588, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} xTriple: {fileID: -4842746724093398965, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} - xQuad: {fileID: -4842746724093398965, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} + xQuad: {fileID: -4646627001110862441, guid: 9c0b392ffb24ca248a002fe36b08bae8, type: 3} viewObstacles: [] opaque: 0 From 7b3a504a40beb5be11573b14ed1636a8da79e292 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 9 Nov 2023 21:19:37 +0100 Subject: [PATCH 74/87] changed material of disposal pipes --- Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta b/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta index edd5744ee8..d438f56dc4 100644 --- a/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta +++ b/Assets/Art/Models/Structures/Pipes/DisposalPipes.fbx.meta @@ -3,7 +3,12 @@ guid: 8fa7941da6a6a8d4da717a97b11b2621 ModelImporter: serializedVersion: 21300 internalIDToNameTable: [] - externalObjects: {} + externalObjects: + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: Palette05 + second: {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} materials: materialImportMode: 2 materialName: 0 From 2f8292118b9d65d23a53ee67216bf077844b7c24 Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 9 Nov 2023 21:19:43 +0100 Subject: [PATCH 75/87] Revert "fix indentation" This reverts commit 8f1825b89c6cce3b5f158e4a228bdabbad85b8c9. --- .../Tile/TileMapCreator/TileMapCreator.cs | 892 +++++++++--------- 1 file changed, 446 insertions(+), 446 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs index f6d896064a..57b79ea374 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs @@ -1,4 +1,4 @@ -using Coimbra; +using Coimbra; using DynamicPanels; using FishNet.Connection; using FishNet.Object; @@ -17,262 +17,262 @@ namespace SS3D.Systems.Tile.TileMapCreator { - /// - /// In-game editor for placing and deleting items/objects in a tilemap. - /// - public class TileMapCreator : NetworkSystem, IPointerEnterHandler, IPointerExitHandler - { - public GameObject _menuRoot; - public GameObject _contentRoot; - public GameObject _slotPrefab; - public TMP_Dropdown _layerPlacementDropdown; - - private bool _enabled = false; - private bool _initalized = false; - private bool _isDeleting = false; - private bool _itemPlacement = false; - private bool _mouseOverUI = false; - - private Vector3 _lastSnappedPosition; - private GenericObjectSo _selectedObject; - - private TileSystem _tileSystem; - private GhostManager _ghostManager; - private Plane _plane; - - private List _objectDatabase; - private Controls.TileCreatorActions _controls; - private InputSystem _inputSystem; + /// + /// In-game editor for placing and deleting items/objects in a tilemap. + /// + public class TileMapCreator : NetworkSystem, IPointerEnterHandler, IPointerExitHandler + { + public GameObject _menuRoot; + public GameObject _contentRoot; + public GameObject _slotPrefab; + public TMP_Dropdown _layerPlacementDropdown; + + private bool _enabled = false; + private bool _initalized = false; + private bool _isDeleting = false; + private bool _itemPlacement = false; + private bool _mouseOverUI = false; + + private Vector3 _lastSnappedPosition; + private GenericObjectSo _selectedObject; + + private TileSystem _tileSystem; + private GhostManager _ghostManager; + private Plane _plane; + + private List _objectDatabase; + private Controls.TileCreatorActions _controls; + private InputSystem _inputSystem; private PanelTab _tab; - public bool IsDeleting - { - get => _isDeleting; - set - { - if (_selectedObject == null) - { - return; - } - - _isDeleting = value; - RefreshGhost(); - } - } - - [ServerOrClient] - protected override void OnStart() - { - base.OnStart(); + public bool IsDeleting + { + get => _isDeleting; + set + { + if (_selectedObject == null) + { + return; + } + + _isDeleting = value; + RefreshGhost(); + } + } + + [ServerOrClient] + protected override void OnStart() + { + base.OnStart(); _tab = PanelUtils.GetAssociatedTab(GetComponent()); ShowUI(false); _inputSystem = Subsystems.Get(); - _controls = _inputSystem.Inputs.TileCreator; - _inputSystem.ToggleAction(_controls.ToggleMenu, true); + _controls = _inputSystem.Inputs.TileCreator; + _inputSystem.ToggleAction(_controls.ToggleMenu, true); _controls.ToggleMenu.performed += HandleToggleMenu; - _controls.Replace.performed += HandleReplace; - _controls.Replace.canceled += HandleReplace; - _controls.Place.performed += HandlePlace; - _controls.Rotate.performed += HandleRotate; + _controls.Replace.performed += HandleReplace; + _controls.Replace.canceled += HandleReplace; + _controls.Place.performed += HandlePlace; + _controls.Rotate.performed += HandleRotate; - } - - private void HandleToggleMenu(InputAction.CallbackContext context) - { - if (_enabled) - { - _inputSystem.ToggleActionMap(_controls, false, new[] - { - _controls.ToggleMenu - }); - - _inputSystem.ToggleCollisions(_controls, true); - } - else - { - _inputSystem.ToggleActionMap(_controls, true, new[] - { - _controls.ToggleMenu - }); - - _inputSystem.ToggleCollisions(_controls, false); - } - - _enabled = !_enabled; - ShowUI(_enabled); - Initialize(); - } - - private void HandleRotate(InputAction.CallbackContext context) - { - _ghostManager.SetNextRotation(); - RefreshGhost(); - } - - private void HandleReplace(InputAction.CallbackContext context) - { - RefreshGhost(); - } - - private void HandlePlace(InputAction.CallbackContext context) - { - if (_mouseOverUI) - { - return; - } - - HandleMouseClick(_lastSnappedPosition, _controls.Replace.phase == InputActionPhase.Performed); - } - - [ServerOrClient] - private void Initialize() - { - if (_initalized) - { - return; - } - - _tileSystem = Subsystems.Get(); - _ghostManager = GetComponent(); - _plane = new Plane(Vector3.up, 0); - - LoadObjectGrid(new[] - { - TileLayer.Plenum - }, false); - - _initalized = true; - } - - [ServerOrClient] - private void Update() - { - if (!_initalized) - { - return; - } - // Clean-up if we are not building - if (_selectedObject == null) - { + } + + private void HandleToggleMenu(InputAction.CallbackContext context) + { + if (_enabled) + { + _inputSystem.ToggleActionMap(_controls, false, new[] + { + _controls.ToggleMenu + }); + + _inputSystem.ToggleCollisions(_controls, true); + } + else + { + _inputSystem.ToggleActionMap(_controls, true, new[] + { + _controls.ToggleMenu + }); + + _inputSystem.ToggleCollisions(_controls, false); + } + + _enabled = !_enabled; + ShowUI(_enabled); + Initialize(); + } + + private void HandleRotate(InputAction.CallbackContext context) + { + _ghostManager.SetNextRotation(); + RefreshGhost(); + } + + private void HandleReplace(InputAction.CallbackContext context) + { + RefreshGhost(); + } + + private void HandlePlace(InputAction.CallbackContext context) + { + if (_mouseOverUI) + { + return; + } + + HandleMouseClick(_lastSnappedPosition, _controls.Replace.phase == InputActionPhase.Performed); + } + + [ServerOrClient] + private void Initialize() + { + if (_initalized) + { + return; + } + + _tileSystem = Subsystems.Get(); + _ghostManager = GetComponent(); + _plane = new Plane(Vector3.up, 0); + + LoadObjectGrid(new[] + { + TileLayer.Plenum + }, false); + + _initalized = true; + } + + [ServerOrClient] + private void Update() + { + if (!_initalized) + { + return; + } + // Clean-up if we are not building + if (_selectedObject == null) + { _ghostManager.DestroyGhost(); return; - } - - _ghostManager.CreateGhost(_selectedObject.prefab); - - // Check if mouse moved - Vector3 snappedPosition = TileHelper.GetClosestPosition(GetMousePosition()); - - if (snappedPosition != _lastSnappedPosition && !_itemPlacement) - { - _ghostManager.SetTargetPosition(snappedPosition); - _lastSnappedPosition = snappedPosition; - RefreshGhost(); - } - - if (_itemPlacement) - { - Vector3 newPosition = GetMousePosition(); - _ghostManager.SetTargetPosition(newPosition); - _lastSnappedPosition = newPosition; - } - - _ghostManager.MoveGhost(); - } - - [ServerOrClient] - private void HandleMouseClick(Vector3 snappedPosition, bool replaceExisting) - { - if (_isDeleting) - { - if (_itemPlacement) - { - FindAndDeleteItem(snappedPosition); - } - else - { - _tileSystem.RpcClearTileObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir); - } - } - else - { - if (_selectedObject == null) - { - return; - } - - _tileSystem.RpcPlaceObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir, replaceExisting); - RefreshGhost(); - } - } - - [ServerOrClient] - private void FindAndDeleteItem(Vector3 worldPosition) - { - Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - - if (Physics.Raycast(ray, out RaycastHit hitInfo)) - { - PlacedItemObject placedItem = hitInfo.collider.gameObject.GetComponent(); - - if (placedItem != null) - { - _tileSystem.RpcClearItemObject(placedItem.NameString, worldPosition); - } - } - } - - [ServerOrClient] - private Vector3 GetMousePosition() - { - Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - - if (_plane.Raycast(ray, out float distance)) - { - return ray.GetPoint(distance); - } - - return Vector3.zero; - } - - [ServerOrClient] - private void CheckBuildValidity(Vector3 placePosition, bool replaceExisting) - { - RpcSendCanBuild(_selectedObject.nameString, placePosition, _ghostManager.Dir, replaceExisting, LocalConnection); - } - - // Ownership not required since a client can request whether it is possible to build - [Client] - [ServerRpc(RequireOwnership = false)] - public void RpcSendCanBuild(string tileObjectSoName, Vector3 placePosition, Direction dir, bool replaceExisting, NetworkConnection conn) - { - if (_tileSystem == null) - { - _tileSystem = Subsystems.Get(); - } - - TileObjectSo tileObjectSo = (TileObjectSo)_tileSystem.GetAsset(tileObjectSoName); - - if (tileObjectSo == null) - { - return; - } - - bool canBuild = _tileSystem.CanBuild(tileObjectSo, placePosition, dir, replaceExisting); - RpcReceiveCanBuild(conn, canBuild); - } - - [Client] - [TargetRpc] - private void RpcReceiveCanBuild(NetworkConnection conn, bool canBuild) - { - _ghostManager.ChangeGhostColor(canBuild ? GhostManager.BuildMatMode.Valid : GhostManager.BuildMatMode.Invalid); - } - - [ServerOrClient] - private void ShowUI(bool show) - { + } + + _ghostManager.CreateGhost(_selectedObject.prefab); + + // Check if mouse moved + Vector3 snappedPosition = TileHelper.GetClosestPosition(GetMousePosition()); + + if (snappedPosition != _lastSnappedPosition && !_itemPlacement) + { + _ghostManager.SetTargetPosition(snappedPosition); + _lastSnappedPosition = snappedPosition; + RefreshGhost(); + } + + if (_itemPlacement) + { + Vector3 newPosition = GetMousePosition(); + _ghostManager.SetTargetPosition(newPosition); + _lastSnappedPosition = newPosition; + } + + _ghostManager.MoveGhost(); + } + + [ServerOrClient] + private void HandleMouseClick(Vector3 snappedPosition, bool replaceExisting) + { + if (_isDeleting) + { + if (_itemPlacement) + { + FindAndDeleteItem(snappedPosition); + } + else + { + _tileSystem.RpcClearTileObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir); + } + } + else + { + if (_selectedObject == null) + { + return; + } + + _tileSystem.RpcPlaceObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir, replaceExisting); + RefreshGhost(); + } + } + + [ServerOrClient] + private void FindAndDeleteItem(Vector3 worldPosition) + { + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + + if (Physics.Raycast(ray, out RaycastHit hitInfo)) + { + PlacedItemObject placedItem = hitInfo.collider.gameObject.GetComponent(); + + if (placedItem != null) + { + _tileSystem.RpcClearItemObject(placedItem.NameString, worldPosition); + } + } + } + + [ServerOrClient] + private Vector3 GetMousePosition() + { + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + + if (_plane.Raycast(ray, out float distance)) + { + return ray.GetPoint(distance); + } + + return Vector3.zero; + } + + [ServerOrClient] + private void CheckBuildValidity(Vector3 placePosition, bool replaceExisting) + { + RpcSendCanBuild(_selectedObject.nameString, placePosition, _ghostManager.Dir, replaceExisting, LocalConnection); + } + + // Ownership not required since a client can request whether it is possible to build + [Client] + [ServerRpc(RequireOwnership = false)] + public void RpcSendCanBuild(string tileObjectSoName, Vector3 placePosition, Direction dir, bool replaceExisting, NetworkConnection conn) + { + if (_tileSystem == null) + { + _tileSystem = Subsystems.Get(); + } + + TileObjectSo tileObjectSo = (TileObjectSo)_tileSystem.GetAsset(tileObjectSoName); + + if (tileObjectSo == null) + { + return; + } + + bool canBuild = _tileSystem.CanBuild(tileObjectSo, placePosition, dir, replaceExisting); + RpcReceiveCanBuild(conn, canBuild); + } + + [Client] + [TargetRpc] + private void RpcReceiveCanBuild(NetworkConnection conn, bool canBuild) + { + _ghostManager.ChangeGhostColor(canBuild ? GhostManager.BuildMatMode.Valid : GhostManager.BuildMatMode.Invalid); + } + + [ServerOrClient] + private void ShowUI(bool show) + { if (!show) { if (_ghostManager) @@ -282,206 +282,206 @@ private void ShowUI(bool show) _tab.Detach(); } _tab.Panel.gameObject.SetActive(show); - _menuRoot.SetActive(show); - } - - /// - /// Loads a list of tile objects and places them in the UI box grid. - /// - /// - /// - [ServerOrClient] - private void LoadObjectGrid(TileLayer[] allowedLayers, bool isItems) - { - ClearGrid(); - - _objectDatabase = _tileSystem.Loader.Assets; - - foreach (GenericObjectSo asset in _objectDatabase) - { - switch (isItems) - { - case true when asset is not ItemObjectSo: - case false when asset is ItemObjectSo: - case false when asset is TileObjectSo so && !allowedLayers.Contains(so.layer): - continue; - } - - GameObject slot = Instantiate(_slotPrefab, _contentRoot.transform, true); - - TileMapCreatorTab tab = slot.AddComponent(); - - tab.Setup(asset); - } - } - - [ServerOrClient] - private void ClearGrid() - { - for (int i = 0; i < _contentRoot.transform.childCount; i++) - { - _contentRoot.transform.GetChild(i).gameObject.Dispose(true); - } - } - - [ServerOrClient] - private void RefreshGhost() - { - if (_selectedObject == null) - { - return; - } - - if (_isDeleting) - { - _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Deleting); - } - else - { - switch (_itemPlacement) - { - case true: - _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Valid); - - break; - case false when _controls.Replace.phase == InputActionPhase.Performed: - CheckBuildValidity(_lastSnappedPosition, true); - - break; - case false: - CheckBuildValidity(_lastSnappedPosition, false); - - break; - } - } - } - - [ServerOrClient] - public void SetSelectedObject(GenericObjectSo genericObjectSo) - { - _itemPlacement = genericObjectSo switch - { - TileObjectSo => false, - ItemObjectSo => true, - _ => _itemPlacement, - }; - - _selectedObject = genericObjectSo; - _ghostManager.DestroyGhost(); - _ghostManager.CreateGhost(genericObjectSo.prefab); - - RefreshGhost(); - } - - [Server] - public void LoadMap() - { - if (IsServer) - { - _tileSystem.Load(); - } - else - { - Log.Information(this, "Cannot load the map on a client"); - } - } - - [Server] - public void SaveMap() - { - if (IsServer) - { - _tileSystem.Save(); - } - else - { - Log.Information(this, "Cannot save the map on a client"); - } - } - - - /// - /// Change the currently displayed tiles/items when a new layer is selected in the drop down menu. - /// - [ServerOrClient] - public void OnDropDownChange() - { - int index = _layerPlacementDropdown.value; - - switch (index) - { - case 0: - LoadObjectGrid(new[] - { - TileLayer.Plenum - }, false); - - break; - case 1: - LoadObjectGrid(new[] - { - TileLayer.Turf - }, false); - - break; - case 2: - LoadObjectGrid(new[] - { - TileLayer.FurnitureBase, - TileLayer.FurnitureTop - }, false); - - break; - case 3: - LoadObjectGrid(new[] - { - TileLayer.WallMountHigh, - TileLayer.WallMountLow - }, false); - - break; - case 4: - LoadObjectGrid(new[] - { - TileLayer.Wire, - TileLayer.Disposal, - TileLayer.PipeLeft, + _menuRoot.SetActive(show); + } + + /// + /// Loads a list of tile objects and places them in the UI box grid. + /// + /// + /// + [ServerOrClient] + private void LoadObjectGrid(TileLayer[] allowedLayers, bool isItems) + { + ClearGrid(); + + _objectDatabase = _tileSystem.Loader.Assets; + + foreach (GenericObjectSo asset in _objectDatabase) + { + switch (isItems) + { + case true when asset is not ItemObjectSo: + case false when asset is ItemObjectSo: + case false when asset is TileObjectSo so && !allowedLayers.Contains(so.layer): + continue; + } + + GameObject slot = Instantiate(_slotPrefab, _contentRoot.transform, true); + + TileMapCreatorTab tab = slot.AddComponent(); + + tab.Setup(asset); + } + } + + [ServerOrClient] + private void ClearGrid() + { + for (int i = 0; i < _contentRoot.transform.childCount; i++) + { + _contentRoot.transform.GetChild(i).gameObject.Dispose(true); + } + } + + [ServerOrClient] + private void RefreshGhost() + { + if (_selectedObject == null) + { + return; + } + + if (_isDeleting) + { + _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Deleting); + } + else + { + switch (_itemPlacement) + { + case true: + _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Valid); + + break; + case false when _controls.Replace.phase == InputActionPhase.Performed: + CheckBuildValidity(_lastSnappedPosition, true); + + break; + case false: + CheckBuildValidity(_lastSnappedPosition, false); + + break; + } + } + } + + [ServerOrClient] + public void SetSelectedObject(GenericObjectSo genericObjectSo) + { + _itemPlacement = genericObjectSo switch + { + TileObjectSo => false, + ItemObjectSo => true, + _ => _itemPlacement, + }; + + _selectedObject = genericObjectSo; + _ghostManager.DestroyGhost(); + _ghostManager.CreateGhost(genericObjectSo.prefab); + + RefreshGhost(); + } + + [Server] + public void LoadMap() + { + if (IsServer) + { + _tileSystem.Load(); + } + else + { + Log.Information(this, "Cannot load the map on a client"); + } + } + + [Server] + public void SaveMap() + { + if (IsServer) + { + _tileSystem.Save(); + } + else + { + Log.Information(this, "Cannot save the map on a client"); + } + } + + + /// + /// Change the currently displayed tiles/items when a new layer is selected in the drop down menu. + /// + [ServerOrClient] + public void OnDropDownChange() + { + int index = _layerPlacementDropdown.value; + + switch (index) + { + case 0: + LoadObjectGrid(new[] + { + TileLayer.Plenum + }, false); + + break; + case 1: + LoadObjectGrid(new[] + { + TileLayer.Turf + }, false); + + break; + case 2: + LoadObjectGrid(new[] + { + TileLayer.FurnitureBase, + TileLayer.FurnitureTop + }, false); + + break; + case 3: + LoadObjectGrid(new[] + { + TileLayer.WallMountHigh, + TileLayer.WallMountLow + }, false); + + break; + case 4: + LoadObjectGrid(new[] + { + TileLayer.Wire, + TileLayer.Disposal, + TileLayer.PipeLeft, TileLayer.PipeRight, TileLayer.PipeSurface, TileLayer.PipeMiddle - }, false); - - break; - case 5: - LoadObjectGrid(new[] - { - TileLayer.Overlays - }, false); - - break; - case 6: - LoadObjectGrid(null, true); - - break; - default: - ClearGrid(); - - break; - } - } - - [ServerOrClient] - public void OnPointerEnter(PointerEventData eventData) - { - _mouseOverUI = true; - Subsystems.Get().ToggleBinding("/scroll/y", false); - } - - [ServerOrClient] - public void OnPointerExit(PointerEventData eventData) - { - _mouseOverUI = false; - Subsystems.Get().ToggleBinding("/scroll/y", true); - } - } + }, false); + + break; + case 5: + LoadObjectGrid(new[] + { + TileLayer.Overlays + }, false); + + break; + case 6: + LoadObjectGrid(null, true); + + break; + default: + ClearGrid(); + + break; + } + } + + [ServerOrClient] + public void OnPointerEnter(PointerEventData eventData) + { + _mouseOverUI = true; + Subsystems.Get().ToggleBinding("/scroll/y", false); + } + + [ServerOrClient] + public void OnPointerExit(PointerEventData eventData) + { + _mouseOverUI = false; + Subsystems.Get().ToggleBinding("/scroll/y", true); + } + } } \ No newline at end of file From 1f478132eab2cf82349631bce4f12f1601ffc86e Mon Sep 17 00:00:00 2001 From: stilnat Date: Thu, 9 Nov 2023 21:21:02 +0100 Subject: [PATCH 76/87] fix indentation --- .../Tile/TileMapCreator/TileMapCreator.cs | 870 +++++++++--------- 1 file changed, 435 insertions(+), 435 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs index 56ed471b13..9f5d8b3de2 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMapCreator/TileMapCreator.cs @@ -17,264 +17,264 @@ namespace SS3D.Systems.Tile.TileMapCreator { - /// - /// In-game editor for placing and deleting items/objects in a tilemap. - /// - public class TileMapCreator : NetworkSystem, IPointerEnterHandler, IPointerExitHandler - { - public GameObject _menuRoot; - public GameObject _contentRoot; - public GameObject _slotPrefab; - public TMP_Dropdown _layerPlacementDropdown; + /// + /// In-game editor for placing and deleting items/objects in a tilemap. + /// + public class TileMapCreator : NetworkSystem, IPointerEnterHandler, IPointerExitHandler + { + public GameObject _menuRoot; + public GameObject _contentRoot; + public GameObject _slotPrefab; + public TMP_Dropdown _layerPlacementDropdown; [SerializeField] private TMP_InputField _inputField; - private bool _enabled = false; - private bool _initalized = false; - private bool _isDeleting = false; - private bool _itemPlacement = false; - private bool _mouseOverUI = false; + private bool _enabled = false; + private bool _initalized = false; + private bool _isDeleting = false; + private bool _itemPlacement = false; + private bool _mouseOverUI = false; - private Vector3 _lastSnappedPosition; - private GenericObjectSo _selectedObject; + private Vector3 _lastSnappedPosition; + private GenericObjectSo _selectedObject; - private TileSystem _tileSystem; - private GhostManager _ghostManager; - private Plane _plane; + private TileSystem _tileSystem; + private GhostManager _ghostManager; + private Plane _plane; - private List _objectDatabase; - private Controls.TileCreatorActions _controls; - private InputSystem _inputSystem; + private List _objectDatabase; + private Controls.TileCreatorActions _controls; + private InputSystem _inputSystem; private PanelTab _tab; - public bool IsDeleting - { - get => _isDeleting; - set - { - if (_selectedObject == null) - { - return; - } - - _isDeleting = value; - RefreshGhost(); - } - } - - [ServerOrClient] - protected override void OnStart() - { - base.OnStart(); + public bool IsDeleting + { + get => _isDeleting; + set + { + if (_selectedObject == null) + { + return; + } + + _isDeleting = value; + RefreshGhost(); + } + } + + [ServerOrClient] + protected override void OnStart() + { + base.OnStart(); _tab = PanelUtils.GetAssociatedTab(GetComponent()); ShowUI(false); _inputSystem = Subsystems.Get(); - _controls = _inputSystem.Inputs.TileCreator; - _inputSystem.ToggleAction(_controls.ToggleMenu, true); + _controls = _inputSystem.Inputs.TileCreator; + _inputSystem.ToggleAction(_controls.ToggleMenu, true); _controls.ToggleMenu.performed += HandleToggleMenu; - _controls.Replace.performed += HandleReplace; - _controls.Replace.canceled += HandleReplace; - _controls.Place.performed += HandlePlace; - _controls.Rotate.performed += HandleRotate; + _controls.Replace.performed += HandleReplace; + _controls.Replace.canceled += HandleReplace; + _controls.Place.performed += HandlePlace; + _controls.Rotate.performed += HandleRotate; - } - - private void HandleToggleMenu(InputAction.CallbackContext context) - { - if (_enabled) - { - _inputSystem.ToggleActionMap(_controls, false, new[] - { - _controls.ToggleMenu - }); - - _inputSystem.ToggleCollisions(_controls, true); - } - else - { - _inputSystem.ToggleActionMap(_controls, true, new[] - { - _controls.ToggleMenu - }); - - _inputSystem.ToggleCollisions(_controls, false); - } - - _enabled = !_enabled; - ShowUI(_enabled); - Initialize(); - } - - private void HandleRotate(InputAction.CallbackContext context) - { - _ghostManager.SetNextRotation(); - RefreshGhost(); - } - - private void HandleReplace(InputAction.CallbackContext context) - { - RefreshGhost(); - } - - private void HandlePlace(InputAction.CallbackContext context) - { - if (_mouseOverUI) - { - return; - } - - HandleMouseClick(_lastSnappedPosition, _controls.Replace.phase == InputActionPhase.Performed); - } - - [ServerOrClient] - private void Initialize() - { - if (_initalized) - { - return; - } - - _tileSystem = Subsystems.Get(); - _ghostManager = GetComponent(); - _plane = new Plane(Vector3.up, 0); - - LoadObjectGrid(new[] - { - TileLayer.Plenum - }, false); - - _initalized = true; - } - - [ServerOrClient] - private void Update() - { - if (!_initalized) - { - return; - } - // Clean-up if we are not building - if (_selectedObject == null) - { + } + + private void HandleToggleMenu(InputAction.CallbackContext context) + { + if (_enabled) + { + _inputSystem.ToggleActionMap(_controls, false, new[] + { + _controls.ToggleMenu + }); + + _inputSystem.ToggleCollisions(_controls, true); + } + else + { + _inputSystem.ToggleActionMap(_controls, true, new[] + { + _controls.ToggleMenu + }); + + _inputSystem.ToggleCollisions(_controls, false); + } + + _enabled = !_enabled; + ShowUI(_enabled); + Initialize(); + } + + private void HandleRotate(InputAction.CallbackContext context) + { + _ghostManager.SetNextRotation(); + RefreshGhost(); + } + + private void HandleReplace(InputAction.CallbackContext context) + { + RefreshGhost(); + } + + private void HandlePlace(InputAction.CallbackContext context) + { + if (_mouseOverUI) + { + return; + } + + HandleMouseClick(_lastSnappedPosition, _controls.Replace.phase == InputActionPhase.Performed); + } + + [ServerOrClient] + private void Initialize() + { + if (_initalized) + { + return; + } + + _tileSystem = Subsystems.Get(); + _ghostManager = GetComponent(); + _plane = new Plane(Vector3.up, 0); + + LoadObjectGrid(new[] + { + TileLayer.Plenum + }, false); + + _initalized = true; + } + + [ServerOrClient] + private void Update() + { + if (!_initalized) + { + return; + } + // Clean-up if we are not building + if (_selectedObject == null) + { _ghostManager.DestroyGhost(); return; - } - - _ghostManager.CreateGhost(_selectedObject.prefab); - - // Check if mouse moved - Vector3 snappedPosition = TileHelper.GetClosestPosition(GetMousePosition()); - - if (snappedPosition != _lastSnappedPosition && !_itemPlacement) - { - _ghostManager.SetTargetPosition(snappedPosition); - _lastSnappedPosition = snappedPosition; - RefreshGhost(); - } - - if (_itemPlacement) - { - Vector3 newPosition = GetMousePosition(); - _ghostManager.SetTargetPosition(newPosition); - _lastSnappedPosition = newPosition; - } - - _ghostManager.MoveGhost(); - } - - [ServerOrClient] - private void HandleMouseClick(Vector3 snappedPosition, bool replaceExisting) - { - if (_isDeleting) - { - if (_itemPlacement) - { - FindAndDeleteItem(snappedPosition); - } - else - { - _tileSystem.RpcClearTileObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir); - } - } - else - { - if (_selectedObject == null) - { - return; - } - - _tileSystem.RpcPlaceObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir, replaceExisting); - RefreshGhost(); - } - } - - [ServerOrClient] - private void FindAndDeleteItem(Vector3 worldPosition) - { - Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - - if (Physics.Raycast(ray, out RaycastHit hitInfo)) - { - PlacedItemObject placedItem = hitInfo.collider.gameObject.GetComponent(); - - if (placedItem != null) - { - _tileSystem.RpcClearItemObject(placedItem.NameString, worldPosition); - } - } - } - - [ServerOrClient] - private Vector3 GetMousePosition() - { - Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - - if (_plane.Raycast(ray, out float distance)) - { - return ray.GetPoint(distance); - } - - return Vector3.zero; - } - - [ServerOrClient] - private void CheckBuildValidity(Vector3 placePosition, bool replaceExisting) - { - RpcSendCanBuild(_selectedObject.nameString, placePosition, _ghostManager.Dir, replaceExisting, LocalConnection); - } - - // Ownership not required since a client can request whether it is possible to build - [Client] - [ServerRpc(RequireOwnership = false)] - public void RpcSendCanBuild(string tileObjectSoName, Vector3 placePosition, Direction dir, bool replaceExisting, NetworkConnection conn) - { - if (_tileSystem == null) - { - _tileSystem = Subsystems.Get(); - } - - TileObjectSo tileObjectSo = (TileObjectSo)_tileSystem.GetAsset(tileObjectSoName); - - if (tileObjectSo == null) - { - return; - } - - bool canBuild = _tileSystem.CanBuild(tileObjectSo, placePosition, dir, replaceExisting); - RpcReceiveCanBuild(conn, canBuild); - } - - [Client] - [TargetRpc] - private void RpcReceiveCanBuild(NetworkConnection conn, bool canBuild) - { - _ghostManager.ChangeGhostColor(canBuild ? GhostManager.BuildMatMode.Valid : GhostManager.BuildMatMode.Invalid); - } - - [ServerOrClient] - private void ShowUI(bool show) - { + } + + _ghostManager.CreateGhost(_selectedObject.prefab); + + // Check if mouse moved + Vector3 snappedPosition = TileHelper.GetClosestPosition(GetMousePosition()); + + if (snappedPosition != _lastSnappedPosition && !_itemPlacement) + { + _ghostManager.SetTargetPosition(snappedPosition); + _lastSnappedPosition = snappedPosition; + RefreshGhost(); + } + + if (_itemPlacement) + { + Vector3 newPosition = GetMousePosition(); + _ghostManager.SetTargetPosition(newPosition); + _lastSnappedPosition = newPosition; + } + + _ghostManager.MoveGhost(); + } + + [ServerOrClient] + private void HandleMouseClick(Vector3 snappedPosition, bool replaceExisting) + { + if (_isDeleting) + { + if (_itemPlacement) + { + FindAndDeleteItem(snappedPosition); + } + else + { + _tileSystem.RpcClearTileObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir); + } + } + else + { + if (_selectedObject == null) + { + return; + } + + _tileSystem.RpcPlaceObject(_selectedObject.nameString, snappedPosition, _ghostManager.Dir, replaceExisting); + RefreshGhost(); + } + } + + [ServerOrClient] + private void FindAndDeleteItem(Vector3 worldPosition) + { + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + + if (Physics.Raycast(ray, out RaycastHit hitInfo)) + { + PlacedItemObject placedItem = hitInfo.collider.gameObject.GetComponent(); + + if (placedItem != null) + { + _tileSystem.RpcClearItemObject(placedItem.NameString, worldPosition); + } + } + } + + [ServerOrClient] + private Vector3 GetMousePosition() + { + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + + if (_plane.Raycast(ray, out float distance)) + { + return ray.GetPoint(distance); + } + + return Vector3.zero; + } + + [ServerOrClient] + private void CheckBuildValidity(Vector3 placePosition, bool replaceExisting) + { + RpcSendCanBuild(_selectedObject.nameString, placePosition, _ghostManager.Dir, replaceExisting, LocalConnection); + } + + // Ownership not required since a client can request whether it is possible to build + [Client] + [ServerRpc(RequireOwnership = false)] + public void RpcSendCanBuild(string tileObjectSoName, Vector3 placePosition, Direction dir, bool replaceExisting, NetworkConnection conn) + { + if (_tileSystem == null) + { + _tileSystem = Subsystems.Get(); + } + + TileObjectSo tileObjectSo = (TileObjectSo)_tileSystem.GetAsset(tileObjectSoName); + + if (tileObjectSo == null) + { + return; + } + + bool canBuild = _tileSystem.CanBuild(tileObjectSo, placePosition, dir, replaceExisting); + RpcReceiveCanBuild(conn, canBuild); + } + + [Client] + [TargetRpc] + private void RpcReceiveCanBuild(NetworkConnection conn, bool canBuild) + { + _ghostManager.ChangeGhostColor(canBuild ? GhostManager.BuildMatMode.Valid : GhostManager.BuildMatMode.Invalid); + } + + [ServerOrClient] + private void ShowUI(bool show) + { if (!show) { if (_ghostManager) @@ -284,193 +284,193 @@ private void ShowUI(bool show) _tab.Detach(); } _tab.Panel.gameObject.SetActive(show); - _menuRoot.SetActive(show); - } - - /// - /// Loads a list of tile objects and places them in the UI box grid. - /// - /// - /// - [ServerOrClient] - private void LoadObjectGrid(TileLayer[] allowedLayers, bool isItems) - { - ClearGrid(); - - _objectDatabase = _tileSystem.Loader.Assets; - - foreach (GenericObjectSo asset in _objectDatabase) - { - switch (isItems) - { - case true when asset is not ItemObjectSo: - case false when asset is ItemObjectSo: - case false when asset is TileObjectSo so && !allowedLayers.Contains(so.layer): - continue; - } - - GameObject slot = Instantiate(_slotPrefab, _contentRoot.transform, true); - - TileMapCreatorTab tab = slot.AddComponent(); - - tab.Setup(asset); - } - } - - [ServerOrClient] - private void ClearGrid() - { - for (int i = 0; i < _contentRoot.transform.childCount; i++) - { - _contentRoot.transform.GetChild(i).gameObject.Dispose(true); - } - } - - [ServerOrClient] - private void RefreshGhost() - { - if (_selectedObject == null) - { - return; - } - - if (_isDeleting) - { - _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Deleting); - } - else - { - switch (_itemPlacement) - { - case true: - _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Valid); - - break; - case false when _controls.Replace.phase == InputActionPhase.Performed: - CheckBuildValidity(_lastSnappedPosition, true); - - break; - case false: - CheckBuildValidity(_lastSnappedPosition, false); - - break; - } - } - } - - [ServerOrClient] - public void SetSelectedObject(GenericObjectSo genericObjectSo) - { - _itemPlacement = genericObjectSo switch - { - TileObjectSo => false, - ItemObjectSo => true, - _ => _itemPlacement, - }; - - _selectedObject = genericObjectSo; - _ghostManager.DestroyGhost(); - _ghostManager.CreateGhost(genericObjectSo.prefab); - - RefreshGhost(); - } - - [Server] - public void LoadMap() - { - if (IsServer) - { - _tileSystem.Load(); - } - else - { - Log.Information(this, "Cannot load the map on a client"); - } - } - - [Server] - public void SaveMap() - { - if (IsServer) - { - _tileSystem.Save(); - } - else - { - Log.Information(this, "Cannot save the map on a client"); - } - } - - - /// - /// Change the currently displayed tiles/items when a new layer is selected in the drop down menu. - /// - [ServerOrClient] - public void OnDropDownChange() - { - int index = _layerPlacementDropdown.value; - - switch (index) - { - case 0: - LoadObjectGrid(new[] - { - TileLayer.Plenum - }, false); - - break; - case 1: - LoadObjectGrid(new[] - { - TileLayer.Turf - }, false); - - break; - case 2: - LoadObjectGrid(new[] - { - TileLayer.FurnitureBase, - TileLayer.FurnitureTop - }, false); - - break; - case 3: - LoadObjectGrid(new[] - { - TileLayer.WallMountHigh, - TileLayer.WallMountLow - }, false); - - break; - case 4: - LoadObjectGrid(new[] - { - TileLayer.Wire, - TileLayer.Disposal, - TileLayer.PipeLeft, + _menuRoot.SetActive(show); + } + + /// + /// Loads a list of tile objects and places them in the UI box grid. + /// + /// + /// + [ServerOrClient] + private void LoadObjectGrid(TileLayer[] allowedLayers, bool isItems) + { + ClearGrid(); + + _objectDatabase = _tileSystem.Loader.Assets; + + foreach (GenericObjectSo asset in _objectDatabase) + { + switch (isItems) + { + case true when asset is not ItemObjectSo: + case false when asset is ItemObjectSo: + case false when asset is TileObjectSo so && !allowedLayers.Contains(so.layer): + continue; + } + + GameObject slot = Instantiate(_slotPrefab, _contentRoot.transform, true); + + TileMapCreatorTab tab = slot.AddComponent(); + + tab.Setup(asset); + } + } + + [ServerOrClient] + private void ClearGrid() + { + for (int i = 0; i < _contentRoot.transform.childCount; i++) + { + _contentRoot.transform.GetChild(i).gameObject.Dispose(true); + } + } + + [ServerOrClient] + private void RefreshGhost() + { + if (_selectedObject == null) + { + return; + } + + if (_isDeleting) + { + _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Deleting); + } + else + { + switch (_itemPlacement) + { + case true: + _ghostManager.ChangeGhostColor(GhostManager.BuildMatMode.Valid); + + break; + case false when _controls.Replace.phase == InputActionPhase.Performed: + CheckBuildValidity(_lastSnappedPosition, true); + + break; + case false: + CheckBuildValidity(_lastSnappedPosition, false); + + break; + } + } + } + + [ServerOrClient] + public void SetSelectedObject(GenericObjectSo genericObjectSo) + { + _itemPlacement = genericObjectSo switch + { + TileObjectSo => false, + ItemObjectSo => true, + _ => _itemPlacement, + }; + + _selectedObject = genericObjectSo; + _ghostManager.DestroyGhost(); + _ghostManager.CreateGhost(genericObjectSo.prefab); + + RefreshGhost(); + } + + [Server] + public void LoadMap() + { + if (IsServer) + { + _tileSystem.Load(); + } + else + { + Log.Information(this, "Cannot load the map on a client"); + } + } + + [Server] + public void SaveMap() + { + if (IsServer) + { + _tileSystem.Save(); + } + else + { + Log.Information(this, "Cannot save the map on a client"); + } + } + + + /// + /// Change the currently displayed tiles/items when a new layer is selected in the drop down menu. + /// + [ServerOrClient] + public void OnDropDownChange() + { + int index = _layerPlacementDropdown.value; + + switch (index) + { + case 0: + LoadObjectGrid(new[] + { + TileLayer.Plenum + }, false); + + break; + case 1: + LoadObjectGrid(new[] + { + TileLayer.Turf + }, false); + + break; + case 2: + LoadObjectGrid(new[] + { + TileLayer.FurnitureBase, + TileLayer.FurnitureTop + }, false); + + break; + case 3: + LoadObjectGrid(new[] + { + TileLayer.WallMountHigh, + TileLayer.WallMountLow + }, false); + + break; + case 4: + LoadObjectGrid(new[] + { + TileLayer.Wire, + TileLayer.Disposal, + TileLayer.PipeLeft, TileLayer.PipeRight, TileLayer.PipeSurface, TileLayer.PipeMiddle - }, false); + }, false); - break; - case 5: - LoadObjectGrid(new[] - { - TileLayer.Overlays - }, false); + break; + case 5: + LoadObjectGrid(new[] + { + TileLayer.Overlays + }, false); - break; - case 6: - LoadObjectGrid(null, true); + break; + case 6: + LoadObjectGrid(null, true); - break; - default: - ClearGrid(); + break; + default: + ClearGrid(); - break; - } - } + break; + } + } public void OnInputFieldChanged() { @@ -503,17 +503,17 @@ public void OnInputFieldDeselect() } [ServerOrClient] - public void OnPointerEnter(PointerEventData eventData) - { - _mouseOverUI = true; - Subsystems.Get().ToggleBinding("/scroll/y", false); - } - - [ServerOrClient] - public void OnPointerExit(PointerEventData eventData) - { - _mouseOverUI = false; - Subsystems.Get().ToggleBinding("/scroll/y", true); - } - } + public void OnPointerEnter(PointerEventData eventData) + { + _mouseOverUI = true; + Subsystems.Get().ToggleBinding("/scroll/y", false); + } + + [ServerOrClient] + public void OnPointerExit(PointerEventData eventData) + { + _mouseOverUI = false; + Subsystems.Get().ToggleBinding("/scroll/y", true); + } + } } \ No newline at end of file From ed4fa83cca5967166f648ac179aaea1a91a68ef7 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 10 Nov 2023 13:08:54 +0100 Subject: [PATCH 77/87] fix errors introduced by merge --- .../DirectionnalAdjacencyConnector.cs | 17 +++++++++++++---- .../Tile/PlacedObjects/PlacedTileObject.cs | 1 + Assets/Scripts/SS3D/Systems/Tile/TileMap.cs | 7 ++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 191636e7a3..003c76bea9 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -88,18 +88,27 @@ private void Setup() } } + public List GetNeighbours() + { + Setup(); + /*List neighbours = new(); + if(_firstNeighbour != null) neighbours.Add(_firstNeighbour); + if (_secondNeighbour != null) neighbours.Add(_secondNeighbour);*/ + return GetNeighbourDirectionnal(); + } + /// /// implement /// - public bool IsConnected(Direction dir, PlacedTileObject neighbourObject) + public bool IsConnected(PlacedTileObject neighbourObject) { - return true; + return neighbourObject == _firstNeighbour || neighbourObject == _secondNeighbour; } // ignore param - public void UpdateAllConnections(PlacedTileObject[] neighbourObjects) + public void UpdateAllConnections() { - foreach(var neighbourObject in neighbourObjects) + foreach(var neighbourObject in GetNeighbours()) { UpdateAllAndNeighbours(true); } diff --git a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs index bf25c41385..510e6a8917 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/PlacedObjects/PlacedTileObject.cs @@ -271,6 +271,7 @@ public bool HasNeighbourAtDirection(List neighbours, out Place atDirection = null; return false; + } /// Other is a neighbour, placed at some direction from this. /// /// another placedTileObject, which should be neighbouring this. diff --git a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs index d68e01b43d..d4886e76d1 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/TileMap.cs @@ -154,14 +154,15 @@ public PlacedTileObject[] GetNeighbourPlacedObjects(TileLayer layer, Vector3 wor } - public PlacedTileObject[] GetCardinalNeighbourPlacedObjects(TileLayer layer, Vector3 worldPosition) + public List GetCardinalNeighbourPlacedObjects(TileLayer layer, Vector3 worldPosition) { - PlacedTileObject[] adjacentObjects = new PlacedTileObject[8]; + List adjacentObjects = new(); for (Direction direction = Direction.North; direction <= Direction.NorthWest; direction+= 2) { Tuple vector = TileHelper.ToCardinalVector(direction); - adjacentObjects[(int)direction] = GetTileObject(layer, worldPosition + new Vector3(vector.Item1, 0, vector.Item2)).PlacedObject; + adjacentObjects.AddRange( + GetTileLocation(layer, worldPosition + new Vector3(vector.Item1, 0, vector.Item2)).GetAllPlacedObject()); } return adjacentObjects; From d8a305879317c1500938cbb36c74619e8af71b2d Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 10 Nov 2023 20:42:10 +0100 Subject: [PATCH 78/87] update doc --- .../DirectionnalAdjacencyConnector.cs | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 003c76bea9..1d673ad50f 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -45,14 +45,29 @@ public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector private bool _initialized; + /// + /// The current rotation of this directionnal + /// private float _currentRotation; + /// + /// The current number of connected neighbours to this directionnal + /// private int _currentConnections; + /// + /// The current shape the directionnal is taking + /// private AdjacencyShape _currentShape; + /// + /// First connected neighbour of the directionnal + /// private PlacedTileObject _firstNeighbour; + /// + /// Second connected neighbour of the directionnal + /// private PlacedTileObject _secondNeighbour; @@ -91,9 +106,6 @@ private void Setup() public List GetNeighbours() { Setup(); - /*List neighbours = new(); - if(_firstNeighbour != null) neighbours.Add(_firstNeighbour); - if (_secondNeighbour != null) neighbours.Add(_secondNeighbour);*/ return GetNeighbourDirectionnal(); } @@ -114,9 +126,10 @@ public void UpdateAllConnections() } } - - - // ignore param + /// + /// Directionnals should update only their connected neighbours, and should do each time a connection + /// is updated. They can't update a single connection like other connectables. + /// public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObject, bool updateNeighbour) { UpdateAllAndNeighbours(true); @@ -127,6 +140,7 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) { Setup(); var neighbours = GetNeighbourDirectionnal(); + // We don't want to update neighbours which are already fully connected, they should stay as they are. neighbours = neighbours.Where(x => !DirectionnalAlreadyHasTwoConnections(x, true)).ToList(); int connections = 0; @@ -147,8 +161,7 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) _firstNeighbour = first; _secondNeighbour = second; } - - // no connections then + else { results = new Tuple(AdjacencyResolver.o, From 06725811447f3170dcc406444600a88db4f8ae97 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 10 Nov 2023 21:24:24 +0100 Subject: [PATCH 79/87] applied palette on dinerbooth fbx --- .../Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta b/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta index 75d9f3bc6e..c75960e1ff 100644 --- a/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta +++ b/Assets/Art/Models/Furniture/Generic/Seats/DinerBooth.fbx.meta @@ -3,7 +3,12 @@ guid: bcf01b0847ef6d843ae7613281a81df1 ModelImporter: serializedVersion: 21300 internalIDToNameTable: [] - externalObjects: {} + externalObjects: + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: Palette05 + second: {fileID: 2100000, guid: 695c4de41b9578049a93f19b1eef7213, type: 2} materials: materialImportMode: 2 materialName: 0 From 6e9eb9edaaca7a95323a6f489859a3591e68fe44 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 10 Nov 2023 21:24:37 +0100 Subject: [PATCH 80/87] updated dinnerbooth asset --- .../TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset index b3ae6ae014..25d401f247 100644 --- a/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset +++ b/Assets/Content/Data/TileMap/Resources/Furniture/Generic/Seats/DinnerBooth.asset @@ -12,7 +12,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3} m_Name: DinnerBooth m_EditorClassIdentifier: - nameString: + nameString: DinnerBooth prefab: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} icon: {fileID: 0} layer: 7 From b2b2e1db886a1321952ef5da2b104ece0f36696c Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 10 Nov 2023 21:24:47 +0100 Subject: [PATCH 81/87] remove test scene --- Assets/Content/Scenes/Directionnals.unity | 1543 ----------------- .../Content/Scenes/Directionnals.unity.meta | 7 - 2 files changed, 1550 deletions(-) delete mode 100644 Assets/Content/Scenes/Directionnals.unity delete mode 100644 Assets/Content/Scenes/Directionnals.unity.meta diff --git a/Assets/Content/Scenes/Directionnals.unity b/Assets/Content/Scenes/Directionnals.unity deleted file mode 100644 index 477fba447f..0000000000 --- a/Assets/Content/Scenes/Directionnals.unity +++ /dev/null @@ -1,1543 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -OcclusionCullingSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 - m_SceneGUID: 00000000000000000000000000000000 - m_OcclusionCullingData: {fileID: 0} ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 9 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} - m_UseRadianceAmbientProbe: 0 ---- !u!157 &3 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 12 - m_GIWorkflowMode: 1 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 0 - m_LightmapEditorSettings: - serializedVersion: 12 - m_Resolution: 2 - m_BakeResolution: 40 - m_AtlasSize: 1024 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 1 - m_CompAOExponentDirect: 0 - m_ExtractAmbientOcclusion: 0 - m_Padding: 2 - m_LightmapParameters: {fileID: 0} - m_LightmapsBakeMode: 1 - m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherFiltering: 1 - m_FinalGatherRayCount: 256 - m_ReflectionCompression: 2 - m_MixedBakeMode: 2 - m_BakeBackend: 1 - m_PVRSampling: 1 - m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 512 - m_PVRBounces: 2 - m_PVREnvironmentSampleCount: 256 - m_PVREnvironmentReferencePointCount: 2048 - m_PVRFilteringMode: 1 - m_PVRDenoiserTypeDirect: 1 - m_PVRDenoiserTypeIndirect: 1 - m_PVRDenoiserTypeAO: 1 - m_PVRFilterTypeDirect: 0 - m_PVRFilterTypeIndirect: 0 - m_PVRFilterTypeAO: 0 - m_PVREnvironmentMIS: 1 - m_PVRCulling: 1 - m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 - m_PVRFilteringAtrousPositionSigmaDirect: 0.5 - m_PVRFilteringAtrousPositionSigmaIndirect: 2 - m_PVRFilteringAtrousPositionSigmaAO: 1 - m_ExportTrainingData: 0 - m_TrainingDataDestination: TrainingData - m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 0} - m_LightingSettings: {fileID: 0} ---- !u!196 &4 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 2 - agentTypeID: 0 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - minRegionArea: 2 - manualCellSize: 0 - cellSize: 0.16666667 - manualTileSize: 0 - tileSize: 256 - accuratePlacement: 0 - maxJobWorkers: 0 - preserveTilesOutsideBounds: 0 - debug: - m_Flags: 0 - m_NavMeshData: {fileID: 0} ---- !u!1001 &42056749 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 19 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 2.64 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 0.62 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 180 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -819412828331094011, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447837209868186 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothLOut - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &491865392 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 7 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 6.81 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 0.693 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447836290165894 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothI (001) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &521142152 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 9 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 8.2 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: -1.16 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 0.69 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 90 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447836961758221 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothI (003) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1 &626664182 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 626664186} - - component: {fileID: 626664185} - - component: {fileID: 626664184} - - component: {fileID: 626664183} - m_Layer: 0 - m_Name: Plane - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!64 &626664183 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 626664182} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 4 - m_Convex: 0 - m_CookingOptions: 30 - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &626664184 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 626664182} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 5003e6577566f0748b94899aefcc5569, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &626664185 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 626664182} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &626664186 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 626664182} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 2.76, y: -3.1864147, z: 0.5094048} - m_LocalScale: {x: 20, y: 1, z: 20} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &641699770 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 18 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: -2.07 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: -1.44 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8550456321050019914, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447839752735039 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothLIn - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1 &670822652 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 670822654} - - component: {fileID: 670822653} - m_Layer: 0 - m_Name: Spot Light - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!108 &670822653 -Light: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 670822652} - m_Enabled: 1 - serializedVersion: 10 - m_Type: 0 - m_Shape: 0 - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_Intensity: 1.2 - m_Range: 93.09 - m_SpotAngle: 171.9 - m_InnerSpotAngle: 1 - m_CookieSize: 10 - m_Shadows: - m_Type: 0 - m_Resolution: -1 - m_CustomResolution: -1 - m_Strength: 1 - m_Bias: 0.05 - m_NormalBias: 0.4 - m_NearPlane: 0.2 - m_CullingMatrixOverride: - e00: 1 - e01: 0 - e02: 0 - e03: 0 - e10: 0 - e11: 1 - e12: 0 - e13: 0 - e20: 0 - e21: 0 - e22: 1 - e23: 0 - e30: 0 - e31: 0 - e32: 0 - e33: 1 - m_UseCullingMatrixOverride: 0 - m_Cookie: {fileID: 0} - m_DrawHalo: 0 - m_Flare: {fileID: 0} - m_RenderMode: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingLayerMask: 1 - m_Lightmapping: 4 - m_LightShadowCasterMode: 0 - m_AreaSize: {x: 1, y: 1} - m_BounceIntensity: 1 - m_ColorTemperature: 6570 - m_UseColorTemperature: 0 - m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} - m_UseBoundingSphereOverride: 0 - m_UseViewFrustumForShadowCasterCull: 1 - m_ShadowRadius: 0 - m_ShadowAngle: 0 ---- !u!4 &670822654 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 670822652} - m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 5.4012976, y: 14.56, z: 4.61} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!1001 &864419407 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 8 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 5.51 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 0.04 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: -0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 270 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447837454256304 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothI (002) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &879879352 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 6 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 6.83 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: -0.89 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 180 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -2434755278463371002, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447838454335179 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothI - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &956478594 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 10 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 4.34 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 1.57 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447838961165924 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothULeft - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1096799253 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 16 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 2.62 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: -0.46 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 90 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447837133897690 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothURight (002) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1215829029 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 12 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 9.35 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 3.06 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 90 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447837878113859 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothULeft (002) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1216959828 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 4 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 3.52 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 1.66 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447837167626351 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothO (002) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1257945242 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 15 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: -1.38 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 1.64 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 90 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447838841410258 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothURight (001) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1356587983 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 17 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: -2.699 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 1.73 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: -0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 270 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447836705729513 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothURight (003) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1424145921 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 5 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 0.71 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: -0.37 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 90 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447839528395361 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothO (003) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1473862616 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 11 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 8.35 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0.12 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 3.98 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447838969076313 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothULeft (001) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1608970672 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 3 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 1.54 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0.16 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 0.59 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447838630502840 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothO (001) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &1686739664 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: -1.81 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 0.68 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447836182566665 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothO - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &2000198059 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 13 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: 8.311001 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 2.151 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 180 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8315600635035084004, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447839042639380 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothULeft (003) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} ---- !u!1001 &2020792561 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_RootOrder - value: 14 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.x - value: -1.59 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalPosition.z - value: 2.77 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.w - value: -0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.y - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 270 - objectReference: {fileID: 0} - - target: {fileID: 1750478436839435592, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7418334817260183665, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Mesh - value: - objectReference: {fileID: -8218306467633424491, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: _scenePathHash - value: 3726325891 - objectReference: {fileID: 0} - - target: {fileID: 8031370004641457100, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: k__BackingField - value: 16004447838707847314 - objectReference: {fileID: 0} - - target: {fileID: 8085678556641831659, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} - propertyPath: m_Name - value: DinnerBoothURight - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 85fa4c9b76b4b23458dcf24a745a1dfe, type: 3} diff --git a/Assets/Content/Scenes/Directionnals.unity.meta b/Assets/Content/Scenes/Directionnals.unity.meta deleted file mode 100644 index 41d3efc946..0000000000 --- a/Assets/Content/Scenes/Directionnals.unity.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 718efdf7a5aa6c844b3096b9b7486c5f -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From 7d48b3011f035e530a2bef7bbaf1d8910f1cb358 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 10 Nov 2023 22:26:35 +0100 Subject: [PATCH 82/87] add working client --- Assets/Content/Scenes/Game.unity | 8 +++--- .../DirectionnalShapeResolver.cs | 18 +++++++++++++ .../DirectionnalAdjacencyConnector.cs | 26 ++++++++++++++++--- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/Assets/Content/Scenes/Game.unity b/Assets/Content/Scenes/Game.unity index c95d722ba7..241f9ab018 100644 --- a/Assets/Content/Scenes/Game.unity +++ b/Assets/Content/Scenes/Game.unity @@ -557,7 +557,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1506918115} - m_RootOrder: 12 + m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &606666310 MonoBehaviour: @@ -571,7 +571,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ec289a6c0bd24ed40abf0457a8690915, type: 3} m_Name: m_EditorClassIdentifier: - _componentIndexCache: 3 + _componentIndexCache: 4 _addedNetworkObject: {fileID: 1506918116} _networkObjectCache: {fileID: 1506918116} --- !u!1 &616353822 @@ -1384,7 +1384,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4468402021075485018, guid: cc5383d385556f443b2a7d3202f2b2c1, type: 3} propertyPath: m_AnchoredPosition.y - value: -229.99995 + value: -230.00003 objectReference: {fileID: 0} - target: {fileID: 4468402021449001342, guid: cc5383d385556f443b2a7d3202f2b2c1, type: 3} propertyPath: m_AnchoredPosition.x @@ -1708,6 +1708,7 @@ Transform: - {fileID: 439774647} - {fileID: 1980231549} - {fileID: 820019861} + - {fileID: 606666309} m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1731,6 +1732,7 @@ MonoBehaviour: - {fileID: 439774648} - {fileID: 1980231551} - {fileID: 820019862} + - {fileID: 606666310} k__BackingField: {fileID: 0} k__BackingField: - {fileID: 516802435} diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs index 680f964eeb..79a8bc97ab 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/AdjacencyTypes/DirectionnalShapeResolver.cs @@ -175,6 +175,22 @@ private static float LOutLinRotation(AdjacencyMap connections) return 0f; } + public Mesh ShapeToMesh(AdjacencyShape shape) + { + switch(shape) + { + case AdjacencyShape.O: return o; + case AdjacencyShape.ULeft: return uLeft; + case AdjacencyShape.URight: return uRight; + case AdjacencyShape.LIn: return lIn; + case AdjacencyShape.LOut: return lOut; + case AdjacencyShape.I: return i; + default: + Debug.LogError("adjacency shape not found, returning mesh o"); + return o; + } + } + private static Direction LInLOutDirection(Direction firstNeighbour, Direction secondNeighbour) { if((TileHelper.GetAdjacentAndMiddleDirection(Direction.East).Contains(firstNeighbour) @@ -203,5 +219,7 @@ private static Direction LInLOutDirection(Direction firstNeighbour, Direction se return Direction.NorthWest; } } + + } } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 1d673ad50f..22148b3d7e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -1,4 +1,5 @@ -using FishNet.Object.Synchronizing; +using FishNet.Object; +using FishNet.Object.Synchronizing; using SS3D.Core; using SS3D.Core.Behaviours; using SS3D.Logging; @@ -61,12 +62,12 @@ public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector private AdjacencyShape _currentShape; /// - /// First connected neighbour of the directionnal + /// First connected neighbour of the directionnal, server only /// private PlacedTileObject _firstNeighbour; /// - /// Second connected neighbour of the directionnal + /// Second connected neighbour of the directionnal, server only /// private PlacedTileObject _secondNeighbour; @@ -173,6 +174,11 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) bool updated = UpdateMeshRotationDirection(results.Item1, results.Item2, results.Item3, results.Item4, connections); + if (updated) + { + RpcUpdateOnClient(results.Item2, results.Item4); + } + if (updated || updateNeighbour) { foreach(var adjacent in neighbours) @@ -180,6 +186,8 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) adjacent.GetComponent().UpdateAllAndNeighbours(false); } } + + } /// @@ -212,6 +220,18 @@ private bool UpdateMeshRotationDirection(Mesh mesh, float rotation, return updated; } + [ObserversRpc(ExcludeOwner = false, BufferLast = true)] + private void RpcUpdateOnClient(float rotation, AdjacencyShape shape) + { + Quaternion localRotation = transform.localRotation; + Vector3 eulerRotation = localRotation.eulerAngles; + localRotation = Quaternion.Euler(eulerRotation.x, rotation, eulerRotation.z); + transform.localRotation = localRotation; + Mesh mesh = AdjacencyResolver.ShapeToMesh(shape); + _filter.mesh = mesh; + + } + /// /// check if the directionnal has two connections. Single connections for /// directionnals means they are in a particular configuration relative From 3ba1198695918cd725271fef337db653074700b1 Mon Sep 17 00:00:00 2001 From: stilnat Date: Sat, 11 Nov 2023 11:45:52 +0100 Subject: [PATCH 83/87] fix diagonal directionnals not working --- Assets/Scripts/SS3D/Systems/Tile/SO/TileObjectSo.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/SO/TileObjectSo.cs b/Assets/Scripts/SS3D/Systems/Tile/SO/TileObjectSo.cs index 50fa9c2f0a..a0278916a6 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/SO/TileObjectSo.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/SO/TileObjectSo.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; namespace SS3D.Systems.Tile @@ -21,6 +21,9 @@ public class TileObjectSo : GenericObjectSo public int width = 1; public int height = 1; + /// + /// TODO : document and understand properly this method. Why the diagonal directions are not treated ? + /// public List GetGridOffsetList(Direction dir) { List gridOffsetList = new List(); @@ -43,6 +46,12 @@ public List GetGridOffsetList(Direction dir) case Direction.East: gridOffsetList.Add(Vector2Int.zero + new Vector2Int(-x, y)); break; + + // This probably doesn't work for tilemap objects bigger than a single tile + // and facing a diagonal direction. TODO, properly do it for those cases. + default: + gridOffsetList.Add(Vector2Int.zero); + break; } } } From 53be5a561eb0189ba03baecfc3aa868f41b77de3 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 13 Nov 2023 13:03:52 +0100 Subject: [PATCH 84/87] do some clean up --- .../DirectionnalAdjacencyConnector.cs | 78 ++++++++----------- 1 file changed, 31 insertions(+), 47 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 22148b3d7e..8d4c88ae05 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -20,54 +20,55 @@ namespace SS3D.Systems.Tile.Connections { /// - /// ISSUE : I connectors not connecting when one side isn't straight. - /// ISSUE : can't alternate between LIN LOUT diagonnally. + /// Use this script for things such as booths or other models for which direction matters for connections. + /// It should mostly work with models such as booth, bench, and other connectable seats. + /// DO NOT MODIFY WITHOUT A LOT OF CARE. There's a lot of edge cases and it's easy to break it. You've been warned. /// public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector { - protected TileObjectGenericType _genericType; - - - protected TileObjectSpecificType _specificType; - - + /// + /// Struct to help find the right shape, direction and rotation for a given directional. + /// public DirectionnalShapeResolver AdjacencyResolver; - protected AdjacencyMap _adjacencyMap; - + /// + /// The mesh filter of the current directional. + /// protected MeshFilter _filter; + /// + /// The current placed object associated with this connector. + /// protected PlacedTileObject _placedObject; - public PlacedTileObject PlacedObject => _placedObject; - - public Direction PlacedObjectDirection => _placedObject.Direction; - + /// + /// True if the script has been initialized. + /// private bool _initialized; /// - /// The current rotation of this directionnal + /// The current rotation of this directionnal. /// private float _currentRotation; /// - /// The current number of connected neighbours to this directionnal + /// The current number of connected neighbours to this directionnal. /// private int _currentConnections; /// - /// The current shape the directionnal is taking + /// The current shape the directionnal is taking. /// private AdjacencyShape _currentShape; /// - /// First connected neighbour of the directionnal, server only + /// First connected neighbour of the directionnal, server only. /// private PlacedTileObject _firstNeighbour; /// - /// Second connected neighbour of the directionnal, server only + /// Second connected neighbour of the directionnal, server only. /// private PlacedTileObject _secondNeighbour; @@ -86,28 +87,26 @@ private void Setup() { if (!_initialized) { - _adjacencyMap = new AdjacencyMap(); _filter = GetComponent(); _placedObject = GetComponent(); - if (_placedObject == null) - { - _genericType = TileObjectGenericType.None; - _specificType = TileObjectSpecificType.None; - } - else - { - _genericType = _placedObject.GenericType; - _specificType = _placedObject.SpecificType; - } _initialized = true; } } + /// + /// Get all neighbour directionals, in cardinal directions from this. + /// + /// a list of found neighbours. public List GetNeighbours() { Setup(); - return GetNeighbourDirectionnal(); + var tileSystem = Subsystems.Get(); + var map = tileSystem.CurrentMap; + + var neighbours = map.GetCardinalNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); + return neighbours.Where(x => x != null && + x.TryGetComponent(out var component)).ToList(); } /// @@ -140,7 +139,7 @@ public bool UpdateSingleConnection(Direction dir, PlacedTileObject neighbourObje private void UpdateAllAndNeighbours(bool updateNeighbour) { Setup(); - var neighbours = GetNeighbourDirectionnal(); + var neighbours = GetNeighbours(); // We don't want to update neighbours which are already fully connected, they should stay as they are. neighbours = neighbours.Where(x => !DirectionnalAlreadyHasTwoConnections(x, true)).ToList(); int connections = 0; @@ -279,21 +278,6 @@ private bool HasDoubleConnection(List neighbours, || IsSecondLOutConfiguration(neighbours, out first, out second); } - - /// - /// Get all neighbour directionnal, in cardinal directions from this. - /// - /// a list of found neighbours. - private List GetNeighbourDirectionnal() - { - var tileSystem = Subsystems.Get(); - var map = tileSystem.CurrentMap; - - var neighbours = map.GetCardinalNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); - return neighbours.Where(x => x != null && - x.TryGetComponent(out var component)).ToList(); - } - /// /// Given a particular configuration of neighbours with a single connection, /// give all necessary informations on how this directionnal should be. From 62dc2d7ece450769cd09efffc9af42ddbcabd65f Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 13 Nov 2023 13:15:12 +0100 Subject: [PATCH 85/87] update doc --- .../DirectionnalAdjacencyConnector.cs | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs index 8d4c88ae05..9784ea650e 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs @@ -408,7 +408,7 @@ private Tuple SelectMeshDirectionRotatio /// FirstLIn is when a neighbour is in front, /// looking toward east, south-east or north-east and another neighbour on the right, /// looking toward north, north-east or north-west. - /// This method checks that neighbours are respecting those different possibilities. + /// This method checks that this placed object and its neighbours are respecting this configuration. /// private bool IsFirstLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { @@ -458,8 +458,10 @@ private bool IsFirstLInConfiguration(List neighbours, out Plac /// /// (in case of this placed object turned toward north) - /// SecondLIn is when a neighbour is in front, looking toward west, and another neighbour on the left, - /// looking toward north as well. + /// SecondLIn is when a neighbour is in front, looking toward west, south-west or north-west, and another neighbour on the left, + /// looking toward north, north-west or north-east as well. + /// If the placed object is looking in a direction different from north. Just apply the description above with rotating everything. + /// This method checks that this placed object and its neighbours are respecting this configuration. /// private bool IsSecondLInConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { @@ -505,8 +507,10 @@ private bool IsSecondLInConfiguration(List neighbours, out Pla /// /// (in case of this placed object turned toward north) - /// FirstLOut is when a neighbour is behind, looking toward west, and another neighbour on the right, - /// looking toward north as well. + /// FirstLOut is when a neighbour is behind, looking toward west, south-west or north-west, and another neighbour on the right, + /// looking toward north, north-west or north-east as well. + /// If the placed object is looking in a direction different from north. Just apply the description above with rotating everything. + /// This method checks that this placed object and its neighbours are respecting this configuration. /// private bool IsFirstLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { @@ -553,8 +557,10 @@ private bool IsFirstLOutConfiguration(List neighbours, out Pla /// /// (in case of this placed object turned toward north) - /// SecondLOut is when a neighbour is behind, looking toward east, and another neighbour on the left, - /// looking toward north as well. + /// SecondLOut is when a neighbour is behind, looking toward east, south-east or north-east, and another neighbour on the left, + /// looking toward north, north-west or north-east as well. + /// If the placed object is looking in a direction different from north. Just apply the description above with rotating everything. + /// This method checks that this placed object and its neighbours are respecting this configuration. /// private bool IsSecondLOutConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { @@ -599,7 +605,9 @@ private bool IsSecondLOutConfiguration(List neighbours, out Pl } /// - /// + /// An I Configuration is when a directional has two neighbour next to it, on its left and on its right, such that + /// each neighbour is either facing the same direction, or an adjacent one (45 degree direction difference). + /// This method checks that this placed object and its neighbours are respecting this configuration. /// private bool IsIConfiguration(List neighbours, out PlacedTileObject firstNeighbour, out PlacedTileObject secondNeighbour) { @@ -618,7 +626,9 @@ private bool IsIConfiguration(List neighbours, out PlacedTileO } /// - /// Neighbour is on left and looking in the same direction, it's a connection (Ushape) + /// An U Configuration is when a directional has a single neighbour next to it, on its left or right, such that + /// the neighbour is either facing the same direction, or an adjacent one (45 degree direction difference). + /// This method checks that this placed object and its neighbours are respecting this configuration. /// private bool IsUConfiguration(List neighbours, out PlacedTileObject single, bool left) @@ -656,6 +666,13 @@ private bool IsUConfiguration(List neighbours, return AllowedDirections.Contains(single.Direction); } + /// + /// Check if the placed object, which must have a directional adjacency connector component, has already two connections. + /// + /// The placed object we want to test. + /// check if the direction has already two connection without taking into consideration + /// the placed object of this instance. + /// private bool DirectionnalAlreadyHasTwoConnections(PlacedTileObject directionnal, bool excludingThis) { var neighbourConnector = directionnal.GetComponent(); @@ -694,7 +711,7 @@ private bool DirectionnalAlreadyHasTwoConnections(PlacedTileObject directionnal, /// /// first neighbour part of the LIn configuration. /// second neighbour part of the LIn configuration. - /// if the middle (this) is in LIn configuration. + /// if the middle (this placed object) is in LIn configuration. /// the good direction for the middle directionnal. private Direction DirectionInLConfiguration(PlacedTileObject first, PlacedTileObject second, bool LIn) { From bae4aa7ea45bd4992b32816f9ca6fb2a405c0ff4 Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 13 Nov 2023 13:17:01 +0100 Subject: [PATCH 86/87] rename with a single n --- ...nnector.cs => DirectionalAdjacencyConnector.cs} | 14 +++++++------- ....meta => DirectionalAdjacencyConnector.cs.meta} | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename Assets/Scripts/SS3D/Systems/Tile/Connections/{DirectionnalAdjacencyConnector.cs => DirectionalAdjacencyConnector.cs} (98%) rename Assets/Scripts/SS3D/Systems/Tile/Connections/{DirectionnalAdjacencyConnector.cs.meta => DirectionalAdjacencyConnector.cs.meta} (100%) diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionalAdjacencyConnector.cs similarity index 98% rename from Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs rename to Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionalAdjacencyConnector.cs index 9784ea650e..d42e46f45a 100644 --- a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs +++ b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionalAdjacencyConnector.cs @@ -24,7 +24,7 @@ namespace SS3D.Systems.Tile.Connections /// It should mostly work with models such as booth, bench, and other connectable seats. /// DO NOT MODIFY WITHOUT A LOT OF CARE. There's a lot of edge cases and it's easy to break it. You've been warned. /// - public class DirectionnalAdjacencyConnector : NetworkActor, IAdjacencyConnector + public class DirectionalAdjacencyConnector : NetworkActor, IAdjacencyConnector { /// @@ -106,7 +106,7 @@ public List GetNeighbours() var neighbours = map.GetCardinalNeighbourPlacedObjects(_placedObject.Layer, _placedObject.transform.position); return neighbours.Where(x => x != null && - x.TryGetComponent(out var component)).ToList(); + x.TryGetComponent(out var component)).ToList(); } /// @@ -182,7 +182,7 @@ private void UpdateAllAndNeighbours(bool updateNeighbour) { foreach(var adjacent in neighbours) { - adjacent.GetComponent().UpdateAllAndNeighbours(false); + adjacent.GetComponent().UpdateAllAndNeighbours(false); } } @@ -675,12 +675,12 @@ private bool IsUConfiguration(List neighbours, /// private bool DirectionnalAlreadyHasTwoConnections(PlacedTileObject directionnal, bool excludingThis) { - var neighbourConnector = directionnal.GetComponent(); + var neighbourConnector = directionnal.GetComponent(); if (neighbourConnector._currentConnections == 2) { if (excludingThis && - (neighbourConnector._firstNeighbour.GetComponent() == this - || neighbourConnector._secondNeighbour.GetComponent() == this)) + (neighbourConnector._firstNeighbour.GetComponent() == this + || neighbourConnector._secondNeighbour.GetComponent() == this)) { return false; } @@ -721,7 +721,7 @@ private Direction DirectionInLConfiguration(PlacedTileObject first, PlacedTileOb && TileHelper.GetOpposite(first.Direction) != second.Direction && first.Direction != second.Direction) { - if (first.GetComponent()._currentShape == shapeToCheck) + if (first.GetComponent()._currentShape == shapeToCheck) { direction = first.Direction; } diff --git a/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs.meta b/Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionalAdjacencyConnector.cs.meta similarity index 100% rename from Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionnalAdjacencyConnector.cs.meta rename to Assets/Scripts/SS3D/Systems/Tile/Connections/DirectionalAdjacencyConnector.cs.meta From 89afc4082f940fef4875a6ab3b7fea4c9d78be4d Mon Sep 17 00:00:00 2001 From: stilnat Date: Mon, 13 Nov 2023 13:23:37 +0100 Subject: [PATCH 87/87] remove shadows and add collider --- .../Furniture/Generic/Seats/DinnerBooth.prefab | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab b/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab index 1c77aaf50f..9f08285f12 100644 --- a/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab +++ b/Assets/Content/WorldObjects/Furniture/Generic/Seats/DinnerBooth.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 1740478804813226977} - component: {fileID: 7950383285113202337} - component: {fileID: 8031370004641457100} + - component: {fileID: -8047018632482240439} m_Layer: 0 m_Name: DinnerBooth m_TagString: Untagged @@ -51,7 +52,7 @@ MeshRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8085678556641831659} m_Enabled: 1 - m_CastShadows: 1 + m_CastShadows: 0 m_ReceiveShadows: 1 m_DynamicOccludee: 1 m_StaticShadowCaster: 0 @@ -140,3 +141,17 @@ MonoBehaviour: _scenePathHash: 0 k__BackingField: 0 k__BackingField: 3148903556074791268 +--- !u!64 &-8047018632482240439 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8085678556641831659} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 559316708432223863, guid: bcf01b0847ef6d843ae7613281a81df1, type: 3}