From 32e9ccb46d7312c043bb29ddc52835c1d62e7764 Mon Sep 17 00:00:00 2001 From: Touhexel Date: Sat, 22 Aug 2020 07:31:36 -0400 Subject: [PATCH] Audio audio audio --- Assets/RealCode/GameBoard.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Assets/RealCode/GameBoard.cs b/Assets/RealCode/GameBoard.cs index 17c640a..f47c2c3 100644 --- a/Assets/RealCode/GameBoard.cs +++ b/Assets/RealCode/GameBoard.cs @@ -127,6 +127,7 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { if (didActivate || didSpecial) { delayState = DelayState.Combo; ++Combo; + AudioProvider.Unk(); } else { Combo = 0; @@ -169,10 +170,15 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { // TODO - Do a bunch of networking silliness to end the game here } + var dangerLevel = HighestStackWithTrash(board, incomingTrash); + if (dangerLevel > 9) { + AudioProvider.RequestFastMusic(); + desiredAnimation = AnimationName.Sad; + } + // If the player isn't taking actions, trash won't appear, so make instakills kill through inaction if (timeInState > AutoDeathTime) { - var incomingHeight = HighestStackWithTrash(board, incomingTrash); - if (incomingHeight > ROW) { + if (dangerLevel > ROW) { ApplyTrash(); } else { timeInState = 0; // Reset the time in state before we check autodeath again @@ -263,6 +269,8 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { public BoardState DropNow(BoardState bs) { + AudioProvider.Unk(); + bs = Place(bs, currentPair, playerRotation, dropColumn); //this[dropColumn, dropHeight] = TileInfo.CreateRandomBlockTile(); bs = ReduceCountdowns(bs); @@ -453,6 +461,7 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { int trashCursorHead = 0; void ApplyTrash() { if (incomingTrash > 0) { + AudioProvider.Bunk(); delayState = DelayState.Collapse; timeInState = 0; } @@ -704,6 +713,13 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { lastActivatorColor = TileInfo.CreateRandomActivatorTile().color; + // Texel - Ooops we forgot to clear these + trashCursorHead = 0; + incomingTrash = 0; + score = 0; + + render.NickNameText.text = ""; // Clear the nickname text to prevent multi->arcade corruption + nextActivator = TilesUntilActivator; nextSpecial = ActivatorsUntilSpecial; delayState = DelayState.None; @@ -930,7 +946,7 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize { if (!AIEnabled) yield return new WaitUntil(() => AIEnabled); var (r, c) = GetBestMove(board); - Debug.LogFormat("AI: Column {0}, Rotation {1}", c, r); + //Debug.LogFormat("AI: Column {0}, Rotation {1}", c, r); totalMoves += 1; // First match rotation