From 03d9d1d083c9438cc2b5d892ac76221540be88ac Mon Sep 17 00:00:00 2001 From: Texel Date: Sat, 28 Jan 2023 07:29:21 -0500 Subject: [PATCH] Extensive additions to the TileDrawer and Gameboard logic to fix any lurking issues with placing and iterating tile setups for air dropping --- Assets/Art/GenericArtAssets.meta | 8 - Assets/Audio/SFX.meta | 8 - .../PostProcessing Profile.asset | 2 +- Assets/ScriptableObjects.meta | 8 - Assets/Scripts/EntityScripts.meta | 8 - Assets/Scripts/GameManagerScripts.meta | 8 - Assets/Scripts/ScriptableObjectScripts.meta | 8 - Assets/Scripts/UiScripts.meta | 8 - Assets/Texel/Gameplay/GameBoard.cs | 70 +++-- Assets/Texel/Gameplay/GameBoardDrawer.cs | 18 +- .../Texel/Gameplay/Staging/BoardStaging.unity | 259 +++++++++++++++++- .../Gameplay/Staging/Colors/GreenTiles.asset | 12 +- .../Gameplay/Staging/Colors/PinkTiles.asset | 11 +- .../Gameplay/Staging/Colors/PurpleTiles.asset | 12 +- .../{RedTiles.asset => RedTiles-Unused.asset} | 2 +- ....asset.meta => RedTiles-Unused.asset.meta} | 0 .../{BlueTiles.asset => YellowTiles.asset} | 13 +- ...iles.asset.meta => YellowTiles.asset.meta} | 0 Assets/Texel/Gameplay/Staging/TileSet.asset | 19 +- .../Texel/Gameplay/TileObjects/TileDrawer.cs | 51 +++- 20 files changed, 394 insertions(+), 131 deletions(-) delete mode 100644 Assets/Art/GenericArtAssets.meta delete mode 100644 Assets/Audio/SFX.meta delete mode 100644 Assets/ScriptableObjects.meta delete mode 100644 Assets/Scripts/EntityScripts.meta delete mode 100644 Assets/Scripts/GameManagerScripts.meta delete mode 100644 Assets/Scripts/ScriptableObjectScripts.meta delete mode 100644 Assets/Scripts/UiScripts.meta rename Assets/Texel/Gameplay/Staging/Colors/{RedTiles.asset => RedTiles-Unused.asset} (97%) rename Assets/Texel/Gameplay/Staging/Colors/{RedTiles.asset.meta => RedTiles-Unused.asset.meta} (100%) rename Assets/Texel/Gameplay/Staging/Colors/{BlueTiles.asset => YellowTiles.asset} (53%) rename Assets/Texel/Gameplay/Staging/Colors/{BlueTiles.asset.meta => YellowTiles.asset.meta} (100%) diff --git a/Assets/Art/GenericArtAssets.meta b/Assets/Art/GenericArtAssets.meta deleted file mode 100644 index 5470da1..0000000 --- a/Assets/Art/GenericArtAssets.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a5a1671f2bf6f9341b8ec7fc994dcc9e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Audio/SFX.meta b/Assets/Audio/SFX.meta deleted file mode 100644 index 674af17..0000000 --- a/Assets/Audio/SFX.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9583f386cfcb0aa489cef79c2fe974d0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scenes/Lemon_Test_Profiles/PostProcessing Profile.asset b/Assets/Scenes/Lemon_Test_Profiles/PostProcessing Profile.asset index a354153..8bd2410 100644 --- a/Assets/Scenes/Lemon_Test_Profiles/PostProcessing Profile.asset +++ b/Assets/Scenes/Lemon_Test_Profiles/PostProcessing Profile.asset @@ -79,7 +79,7 @@ MonoBehaviour: value: 0 saturation: overrideState: 1 - value: 30 + value: 20 brightness: overrideState: 0 value: 0 diff --git a/Assets/ScriptableObjects.meta b/Assets/ScriptableObjects.meta deleted file mode 100644 index 42c8dcd..0000000 --- a/Assets/ScriptableObjects.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 295ac802c88cd48448df9ecb56c7fb04 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/EntityScripts.meta b/Assets/Scripts/EntityScripts.meta deleted file mode 100644 index f410147..0000000 --- a/Assets/Scripts/EntityScripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eb26112da6fce9c4ca2610cb953c66e6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/GameManagerScripts.meta b/Assets/Scripts/GameManagerScripts.meta deleted file mode 100644 index 94c2b87..0000000 --- a/Assets/Scripts/GameManagerScripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7bdec22f29afa8245899160b77f09c8f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/ScriptableObjectScripts.meta b/Assets/Scripts/ScriptableObjectScripts.meta deleted file mode 100644 index d95b53f..0000000 --- a/Assets/Scripts/ScriptableObjectScripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e8e3cbd1de7025044a7a92113d6e88f0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/UiScripts.meta b/Assets/Scripts/UiScripts.meta deleted file mode 100644 index 33e0776..0000000 --- a/Assets/Scripts/UiScripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bf45ed03d77ae9144849c5d0c914a13d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Texel/Gameplay/GameBoard.cs b/Assets/Texel/Gameplay/GameBoard.cs index c52a7b2..9067ca8 100644 --- a/Assets/Texel/Gameplay/GameBoard.cs +++ b/Assets/Texel/Gameplay/GameBoard.cs @@ -17,7 +17,7 @@ using TileStack = System.Collections.Generic.List; using Cluster = System.Collections.Generic.List<(int x, int y)>; -#region Board Logic +#region Gameboard Class public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { public BoardState board = new BoardState(); @@ -49,17 +49,12 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { // Short form for random tiles TileInfo Random => TileInfo.Random(Options); + // Unit testing! [ContextMenu("Test board")] public void TestBoard() { board = new BoardState(); - /*board[0] = new TileStack(new[] { - new TileInfo(1), - new TileInfo(10), - new TileInfo(100), - new TileInfo(1000), - });*/ for(int i = 0; i < BoardState.BoardWidth; ++i) { - board[i] = new TileStack(new[] { Random, Random, Random }); + board[i] = new TileStack(new[] { Random, Random, Random, Random, Random, Random }); } } @@ -71,6 +66,16 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { [ContextMenu("Recursive Sim")] void RecursiveSim() => board = board.SimulateRecursive(this, out _); + + [ContextMenu("Activate")] + public void Activate() => board = board.Activate(out _); + + [ContextMenu("Break Pending")] + public void BreakPending() => board = board.BreakPending(this, Application.isPlaying); + + [ContextMenu("Collapse")] + public void Collapse() => board = board.Collapse(); + } #endregion @@ -81,7 +86,7 @@ public enum TileColor : byte { Empty = 0, // Used for ID'ing air by color alone Red = 1, - Blue = 2, + Yellow = 2, Green = 3, Pink = 4, Purple = 5, @@ -206,7 +211,15 @@ public class TileInfo { // Make and return a new air tile public static TileInfo Air => new TileInfo(0); // Just air - public bool isAir => data == 0; + public bool isAir { + get { + if (color == TileColor.Empty) return true; + return SameAs(this, Air); + //var irrelevant = TileDetail.Dropped | TileDetail.Poofed | TileDetail.Pending | TileDetail.Exploded; + //var maskedDetail = (byte)detail & ~irrelevant; + + } + } public static implicit operator int(TileInfo ti) => ti.data; public static explicit operator TileInfo(int i) => new TileInfo(i); @@ -373,7 +386,11 @@ public static class BoardLogic { public static Cluster ClusterizeVertical(this BoardState bs, int x, int y) { var stack = bs[x]; + if (stack == null) return null; + if (y >= stack.Count) return null; + var self = stack[y]; + if (self == null) return null; if (self.isAir) return null; @@ -406,12 +423,19 @@ public static class BoardLogic { for (int x = 0; x < bs.state.Count; ++x) { var col = bs[x]; + bool foundAir = false; + for (int i = 0; i < col.Count; ++i) { + col[i] = col[i].SetFalling(foundAir); + if (col[i].isAir) foundAir = true; + } + // First, pad to length with air while (col.Count < BoardState.BoardHeight) col.Add(TileInfo.Air); + // Create an unlinked copy var oldCol = col.Copy(); - + // Remove all air tiles col.RemoveAll(t => t.isAir); // Repad with air @@ -419,10 +443,11 @@ public static class BoardLogic { col.Add(TileInfo.Air); // TODO: Better falling logic - /* + // Set the falling flag for drawing - for(int i = 0; i < col.Count; ++i) { - col[i].SetFalling(TileInfo.SameAs(col[i], oldCol[i])); + /*for(int i = 0; i < col.Count; ++i) { + // Set the falling flag if we match + col[i] = col[i].SetFalling(i > lowestAir); }*/ } return bs; @@ -433,6 +458,8 @@ public static class BoardLogic { var (first, second, third) = m.triplet; + // FIXME SetAtPoint is shite and doesn't work good?? + state.SetAtPoint(m.location, first); state.SetAtPoint(m.locationB, second); state.SetAtPoint(m.locationC, third); @@ -490,7 +517,8 @@ public static class BoardLogic { public static BoardState BreakPending(this BoardState bs, GameBoard gb, bool sendCallbacks = false) { var broken = new Cluster(); for(int x = 0; x < bs.state.Count; ++x) { - for (int y = 0; y < bs.state.Count; ++y) { + var col = bs[x]; + for (int y = 0; y < col.Count; ++y) { var at = bs.tile(x, y); if (at.isAir) continue; // Skip air @@ -500,10 +528,19 @@ public static class BoardLogic { if (sendCallbacks) gb.BreakFX(x, y); - at = at.BreakTile(gb.Options); + + var brokenForm = at.BreakTile(gb.Options); + + col[y] = brokenForm; } } } + + // Break FX callbacks + if (Application.isPlaying && sendCallbacks) + foreach (var broke in broken) + gb.BreakFX(broke.x, broke.y); + return bs; } @@ -518,6 +555,7 @@ public static class BoardLogic { bs = bs.Collapse().Activate(out stepActivations).BreakPending(gb); activations += stepActivations; // Repeat until no new tiles activate + Debug.LogFormat("Processed {0} activations", stepActivations); } while (stepActivations > 0); return bs; diff --git a/Assets/Texel/Gameplay/GameBoardDrawer.cs b/Assets/Texel/Gameplay/GameBoardDrawer.cs index 47015e3..a60b1ee 100644 --- a/Assets/Texel/Gameplay/GameBoardDrawer.cs +++ b/Assets/Texel/Gameplay/GameBoardDrawer.cs @@ -75,11 +75,25 @@ public class GameBoardDrawer : MonoBehaviour { for (int x = 0; x < TileDrawers.Count; ++x) { var col = TileDrawers[x]; + for (int y = 0; y < col.Count; ++y) { var tile = col[y]; + tile.board = gameBoard; + tile.xCoord = x; + tile.yCoord = y; + + if (tile.board) { + var amt = tile.board.board.ClusterizeVertical(x, y); + + if (amt != null) { + tile.amountInStack = amt.Count; + tile.stackedBelow = amt.Count(point => y > point.y); + } + } + var tileT = tile.transform; - tileT.localPosition = new Vector3(x, y) * TileSize; + tileT.localPosition = new Vector3(x, y, -y) * TileSize; if (boardState.TryTileAt(x, y,out TileInfo ti)) { tile.toDraw = ti; } else { @@ -104,6 +118,8 @@ public class GameBoardDrawer : MonoBehaviour { foreach(var td in children) { DestroyImmediate(td.gameObject); } + + TileDrawers = null; } void Update() { diff --git a/Assets/Texel/Gameplay/Staging/BoardStaging.unity b/Assets/Texel/Gameplay/Staging/BoardStaging.unity index 81ea07d..54ed46d 100644 --- a/Assets/Texel/Gameplay/Staging/BoardStaging.unity +++ b/Assets/Texel/Gameplay/Staging/BoardStaging.unity @@ -153,7 +153,7 @@ MonoBehaviour: m_EditorClassIdentifier: TilePrefab: {fileID: 6929433238081324627, guid: 2d35555d89dd5e94fb9527d52c616c11, type: 3} - TileSize: 0.5 + TileSize: 1 --- !u!114 &20737163 MonoBehaviour: m_ObjectHideFlags: 0 @@ -168,7 +168,7 @@ MonoBehaviour: m_EditorClassIdentifier: EntityID: 0 authorityID: -1 - Options: 01020304 + Options: 05020304 --- !u!4 &20737164 Transform: m_ObjectHideFlags: 0 @@ -183,6 +183,194 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &122171322 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 5781547240168325573, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_Name + value: PostProcessingObj + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalPosition.x + value: 0.14437793 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalPosition.y + value: -0.09988037 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalPosition.z + value: -86.22787 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6561464763569930962, guid: bdd4386fa58e67142a500ae58dfb8f30, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: bdd4386fa58e67142a500ae58dfb8f30, type: 3} +--- !u!1001 &505291072 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 5701687554350559536, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_Name + value: PaperTextureOverlay + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5701687554350559540, guid: ea69c30046595724aa7abcecd81deb32, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ea69c30046595724aa7abcecd81deb32, type: 3} --- !u!1 &1062404885 GameObject: m_ObjectHideFlags: 0 @@ -194,6 +382,7 @@ GameObject: - component: {fileID: 1062404888} - component: {fileID: 1062404887} - component: {fileID: 1062404886} + - component: {fileID: 1062404889} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -219,7 +408,7 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_BackGroundColor: {r: 0.73333335, g: 0.69411767, b: 0.9568628, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 @@ -259,10 +448,70 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1062404885} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 2.2195444, y: 6.629975, z: -16.29866} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 5.16, y: 0, z: -27.14} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1062404889 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1062404885} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 1062404888} + volumeLayer: + serializedVersion: 2 + m_Bits: 512 + stopNaNPropagation: 1 + finalBlitToCameraTarget: 0 + antialiasingMode: 0 + temporalAntialiasing: + jitterSpread: 0.75 + sharpness: 0.25 + stationaryBlending: 0.95 + motionBlending: 0.85 + subpixelMorphologicalAntialiasing: + quality: 2 + fastApproximateAntialiasing: + fastMode: 0 + keepAlpha: 0 + fog: + enabled: 1 + excludeSkybox: 1 + debugLayer: + lightMeter: + width: 512 + height: 256 + showCurves: 1 + histogram: + width: 512 + height: 256 + channel: 3 + waveform: + exposure: 0.12 + height: 256 + vectorscope: + size: 256 + exposure: 0.12 + overlaySettings: + linearDepth: 0 + motionColorIntensity: 4 + motionGridSize: 64 + colorBlindnessType: 0 + colorBlindnessStrength: 1 + m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} + m_ShowToolkit: 0 + m_ShowCustomSorter: 1 + breakBeforeColorGrading: 0 + m_BeforeTransparentBundles: [] + m_BeforeStackBundles: [] + m_AfterStackBundles: [] diff --git a/Assets/Texel/Gameplay/Staging/Colors/GreenTiles.asset b/Assets/Texel/Gameplay/Staging/Colors/GreenTiles.asset index 67d12ef..106d0fb 100644 --- a/Assets/Texel/Gameplay/Staging/Colors/GreenTiles.asset +++ b/Assets/Texel/Gameplay/Staging/Colors/GreenTiles.asset @@ -13,12 +13,8 @@ MonoBehaviour: m_Name: GreenTiles m_EditorClassIdentifier: color: 3 - Generic: {fileID: -6936698821596298334, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - TopOfStack: {fileID: 6772703886551230350, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - SecondFromTop: {fileID: -6218849779353356174, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - ThirdOrLower: {fileID: 4496032024674485847, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} + Generic: {fileID: 21300000, guid: 9566535b9396c87478e4136306d2b403, type: 3} + TopOfStack: {fileID: 21300000, guid: 140777d948797cb40af3dc7395ed71ee, type: 3} + SecondFromTop: {fileID: 21300000, guid: 348d7f7284aa1664d8aa79701899ff7b, type: 3} + ThirdOrLower: {fileID: 21300000, guid: a4cbdd75e62afa74cb38d3c8753cb92b, type: 3} Puff: {fileID: 8143975012507443829, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} diff --git a/Assets/Texel/Gameplay/Staging/Colors/PinkTiles.asset b/Assets/Texel/Gameplay/Staging/Colors/PinkTiles.asset index 0f6bd7d..d7faaad 100644 --- a/Assets/Texel/Gameplay/Staging/Colors/PinkTiles.asset +++ b/Assets/Texel/Gameplay/Staging/Colors/PinkTiles.asset @@ -13,11 +13,8 @@ MonoBehaviour: m_Name: PinkTiles m_EditorClassIdentifier: color: 4 - Generic: {fileID: 4141482394071947919, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} - TopOfStack: {fileID: 4445955820842774327, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - SecondFromTop: {fileID: -8603880206502384168, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - ThirdOrLower: {fileID: 7082931030690222455, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} + Generic: {fileID: 21300000, guid: 1b97e1e3f1b18d34f8c777342f256647, type: 3} + TopOfStack: {fileID: 21300000, guid: 3e5c55736df32154eaccf5510d384607, type: 3} + SecondFromTop: {fileID: 21300000, guid: 0c4002562d486634ea5849d207859268, type: 3} + ThirdOrLower: {fileID: 21300000, guid: 47ebbb6720c25c74793be75e54de86a1, type: 3} Puff: {fileID: -3766147651135259226, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} diff --git a/Assets/Texel/Gameplay/Staging/Colors/PurpleTiles.asset b/Assets/Texel/Gameplay/Staging/Colors/PurpleTiles.asset index be147ec..ae23c53 100644 --- a/Assets/Texel/Gameplay/Staging/Colors/PurpleTiles.asset +++ b/Assets/Texel/Gameplay/Staging/Colors/PurpleTiles.asset @@ -13,12 +13,8 @@ MonoBehaviour: m_Name: PurpleTiles m_EditorClassIdentifier: color: 5 - Generic: {fileID: -7185840347270642116, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - TopOfStack: {fileID: -6426366480920576982, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - SecondFromTop: {fileID: 2523502825781429886, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - ThirdOrLower: {fileID: 4109463514366588313, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} + Generic: {fileID: 21300000, guid: fd410fcb15200c24b8e224bd43d9b34e, type: 3} + TopOfStack: {fileID: 21300000, guid: 01ebca9ab57daed44817d6874413894c, type: 3} + SecondFromTop: {fileID: 21300000, guid: 6db51e61120de314eae63fbbc695c36a, type: 3} + ThirdOrLower: {fileID: 21300000, guid: 2d454fbd08c411f4396875af4c1904ed, type: 3} Puff: {fileID: -316062629822355126, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} diff --git a/Assets/Texel/Gameplay/Staging/Colors/RedTiles.asset b/Assets/Texel/Gameplay/Staging/Colors/RedTiles-Unused.asset similarity index 97% rename from Assets/Texel/Gameplay/Staging/Colors/RedTiles.asset rename to Assets/Texel/Gameplay/Staging/Colors/RedTiles-Unused.asset index d565d8e..8e2a492 100644 --- a/Assets/Texel/Gameplay/Staging/Colors/RedTiles.asset +++ b/Assets/Texel/Gameplay/Staging/Colors/RedTiles-Unused.asset @@ -10,7 +10,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fb5a560c08dbb0c4480cebd43af4d199, type: 3} - m_Name: RedTiles + m_Name: RedTiles-Unused m_EditorClassIdentifier: color: 1 Generic: {fileID: -8095011478633053862, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, diff --git a/Assets/Texel/Gameplay/Staging/Colors/RedTiles.asset.meta b/Assets/Texel/Gameplay/Staging/Colors/RedTiles-Unused.asset.meta similarity index 100% rename from Assets/Texel/Gameplay/Staging/Colors/RedTiles.asset.meta rename to Assets/Texel/Gameplay/Staging/Colors/RedTiles-Unused.asset.meta diff --git a/Assets/Texel/Gameplay/Staging/Colors/BlueTiles.asset b/Assets/Texel/Gameplay/Staging/Colors/YellowTiles.asset similarity index 53% rename from Assets/Texel/Gameplay/Staging/Colors/BlueTiles.asset rename to Assets/Texel/Gameplay/Staging/Colors/YellowTiles.asset index 6682d3d..3c5f74a 100644 --- a/Assets/Texel/Gameplay/Staging/Colors/BlueTiles.asset +++ b/Assets/Texel/Gameplay/Staging/Colors/YellowTiles.asset @@ -10,14 +10,11 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fb5a560c08dbb0c4480cebd43af4d199, type: 3} - m_Name: BlueTiles + m_Name: YellowTiles m_EditorClassIdentifier: color: 2 - Generic: {fileID: 3099831667949783345, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} - TopOfStack: {fileID: -1032256510885150944, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - SecondFromTop: {fileID: -8030095101517931983, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - ThirdOrLower: {fileID: 7642638768051401269, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} + Generic: {fileID: 21300000, guid: d583fe4b25f546e4d95c78f04db4199f, type: 3} + TopOfStack: {fileID: 21300000, guid: a738f6c420ba63347b26f1c9de9c6e25, type: 3} + SecondFromTop: {fileID: 21300000, guid: 6a16bb885cf35b241a6335e8dd39530a, type: 3} + ThirdOrLower: {fileID: 21300000, guid: 27a7c767ef7e75247acff9391d1fe434, type: 3} Puff: {fileID: 6779516872222990126, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} diff --git a/Assets/Texel/Gameplay/Staging/Colors/BlueTiles.asset.meta b/Assets/Texel/Gameplay/Staging/Colors/YellowTiles.asset.meta similarity index 100% rename from Assets/Texel/Gameplay/Staging/Colors/BlueTiles.asset.meta rename to Assets/Texel/Gameplay/Staging/Colors/YellowTiles.asset.meta diff --git a/Assets/Texel/Gameplay/Staging/TileSet.asset b/Assets/Texel/Gameplay/Staging/TileSet.asset index 4d2c00d..c12b6a3 100644 --- a/Assets/Texel/Gameplay/Staging/TileSet.asset +++ b/Assets/Texel/Gameplay/Staging/TileSet.asset @@ -18,18 +18,15 @@ MonoBehaviour: - {fileID: 11400000, guid: 196941731704d204f885aa54cbb5b8bf, type: 2} - {fileID: 11400000, guid: 23186780cfc3a1347acd561444139cc7, type: 2} - {fileID: 11400000, guid: 0922e1e6b1ed5124ca13b943384610ee, type: 2} - IceOverlay: {fileID: -5160244557152387853, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - FairyUnderlay: {fileID: -5868263060078136879, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} - Tanuki: {fileID: 3630433040384085778, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} - Rock: {fileID: -7609849284663780198, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} - Seal: {fileID: -2297644416909811431, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} - Bomb: {fileID: -6920159131614611936, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} - Dynamite: {fileID: 5530267107363011928, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, - type: 3} + IceOverlay: {fileID: 21300000, guid: 0c2a57034be842040bacf04045786b0d, type: 3} + FairyUnderlay: {fileID: 21300000, guid: acf1dd9a34148b3468417c36b62aac52, type: 3} + Tanuki: {fileID: 21300000, guid: 442974598bf95ca4596b9db79b82ca71, type: 3} + Rock: {fileID: 21300000, guid: 67c5c125cfa5558468d3b69f8d7c175c, type: 3} + Seal: {fileID: 21300000, guid: a347288d47d726c4a93402f569dc9b41, type: 3} + Bomb: {fileID: 21300000, guid: 6e09953987bbbfc458d5c643f17c2737, type: 3} + Dynamite: {fileID: 21300000, guid: c5ee0016dc8866e408bb21bb418601cd, type: 3} Mystery: {fileID: -4610881938015499699, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} - Spark: {fileID: -4610881938015499699, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} + Spark: {fileID: 21300000, guid: cb007da673cac344fa5b62e18ad37492, type: 3} Explosion: {fileID: -4610881938015499699, guid: ba7046a7d637abc4ba486e3e9e4fcfd3, type: 3} diff --git a/Assets/Texel/Gameplay/TileObjects/TileDrawer.cs b/Assets/Texel/Gameplay/TileObjects/TileDrawer.cs index 8bea302..d4c66be 100644 --- a/Assets/Texel/Gameplay/TileObjects/TileDrawer.cs +++ b/Assets/Texel/Gameplay/TileObjects/TileDrawer.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; [ExecuteAlways] @@ -8,6 +9,10 @@ public class TileDrawer : MonoBehaviour { public TileSetInfo tsi; public TileInfo toDraw; + [Header("Internally Managed")] + public GameBoard board; // Gameboard associated with us + public int xCoord, yCoord; + [Header("Tile Info Testing")] //[EnumFlag] No idea why this isn't working anymore whatever public TileDetail detail = TileDetail.Normal; @@ -16,7 +21,22 @@ public class TileDrawer : MonoBehaviour { // TODO Use this FX hook // This is called BEFORE the tile detail is updated public void OnBreakFX() { - + // Texel - Little test diagonal debug line :) + Debug.DrawLine( + transform.TransformPoint(new Vector3(1, 1)), + transform.TransformPoint(new Vector3(-1, -1)), + Color.red, + 1f); + } + + // Updated while the tile state is pending, that is, ready to be removed + public void UpdatePending() { + // Stacks warble at similar frequency, columns independently + float phaseOffset = 0.8f * xCoord + 0.03f * yCoord; + float warbleSpeed = 8f; + // Warble 5% of scale + float warble = Mathf.Sin((Time.time + phaseOffset) * warbleSpeed) * 0.05f; + transform.localScale = new Vector3(1 + warble, 1 - warble, 1); } void OnValidate() { @@ -93,7 +113,7 @@ public class TileDrawer : MonoBehaviour { // Shift smeared sub-sprite to position layer.transform.localPosition = - new Vector3(0, delta * SmearDistance, 0); + new Vector3(0, delta * SmearDistance, i * 0.001f * SmearSteps); // Set the smear opacity var layerOpacity = opacity * opacityShift * (1 - delta); @@ -146,13 +166,23 @@ public class TileDrawer : MonoBehaviour { if (toDraw == null) return; // Higher tiles draw in front - var t = transform; - t.LeanSetPosZ(t.position.y); + //var t = transform; + //t.LeanSetPosZ(-t.position.y); // Copy the data from the TileInfo reference to local enums color = toDraw.color; detail = toDraw.detail; + // Set the drop smear visibility + // Fade out over time when playing + if (detail.HasFlag(TileDetail.Dropped)){ + smearOpacity = 1f; + } else { + smearOpacity = !Application.isPlaying ? + 0f : + Mathf.MoveTowards(smearOpacity,0f,Time.deltaTime); + } + var sr = GetComponent(); if (!sr) sr = gameObject.AddComponent(); @@ -164,7 +194,7 @@ public class TileDrawer : MonoBehaviour { if (deets != null) { sprite = deets.Generic; // Base of stack - if (amountInStack != 0) { + if (amountInStack > 2) { sprite = deets.ThirdOrLower; if (stackedBelow == 1) sprite = deets.SecondFromTop; @@ -176,10 +206,13 @@ public class TileDrawer : MonoBehaviour { if (detail.HasFlag(TileDetail.Poofed)) sprite = deets.Puff; - - // FIXME This is wrong - if (detail.HasFlag(TileDetail.Pending)) - sprite = deets.Puff; + if (Application.isPlaying) + if (detail.HasFlag(TileDetail.Pending)) { + UpdatePending(); + } else { + transform.localScale = Vector3.one; + } + } else { // no matching TileObject data switch (color) {