small fixes

This commit is contained in:
LadyEbony 2020-08-22 17:31:57 -07:00
parent 928a5e9cef
commit 5164182edb
4 changed files with 36 additions and 21 deletions

View File

@ -772,6 +772,8 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
render.SetAnimation();
render.RenderName();
render.SetComboLevel(Combo);
render.SetScoreValue(score);
@ -790,6 +792,20 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
Register();
}
public void ResetGame() {
trashCursorHead = 0;
incomingTrash = 0;
score = 0;
nextActivator = TilesUntilActivator;
nextSpecial = ActivatorsUntilSpecial;
delayState = DelayState.None;
timeInState = 0;
CurrentDrop = 0;
NextDrop = 0;
}
public void Setup(){
board = BoardStateExtension.Initialize();
@ -802,19 +818,7 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
lastActivatorColor = TileInfo.CreateRandomActivatorTile().color;
// Texel - Ooops we forgot to clear these
trashCursorHead = 0;
incomingTrash = 0;
score = 0;
render.RenderName();
nextActivator = TilesUntilActivator;
nextSpecial = ActivatorsUntilSpecial;
delayState = DelayState.None;
timeInState = 0;
CurrentDrop = 0;
NextDrop = 0;
ResetGame();
}
public void StartGame(){

View File

@ -66,8 +66,7 @@ public class GameBoardInstance : MonoBehaviour {
case 1:
case -2:
GameTransition.Instance.state = GameState.Lobby;
player1.Clear();
player2.Clear();
ClearGame();
break;
// rematch
case 2:
@ -76,19 +75,27 @@ public class GameBoardInstance : MonoBehaviour {
// disconnected
case -3:
GameTransition.Instance.state = GameState.Menu;
player1.Clear();
player2.Clear();
ClearGame();
break;
default: break;
}
}
}
public void ResetGame(){
player1.ResetGame();
player2.ResetGame();
}
public void ClearGame(){
player1.Clear();
player2.Clear();
}
public void SetupGame(){
System.Action callback;
player1.Clear();
player2.Clear();
ClearGame();
if (NetworkManager.inRoom){
var players = NetworkManager.net.CurrentRoom.Players.Values.OrderBy(p => p.ID);
@ -164,8 +171,7 @@ public class GameBoardInstance : MonoBehaviour {
player1.Stop();
player2.Stop();
player1.Clear();
player2.Clear();
ClearGame();
if (NetworkManager.inRoom){
NetworkManager.net.OpLeaveRoom();

View File

@ -55,6 +55,10 @@ public class GameBoardRender : MonoBehaviour {
index = board.delayState == GameBoard.DelayState.Loss ? 2 : 1;
}
}
// lobby edge case
else if (GameTransition.Instance.state == GameState.Lobby){
index = 0;
}
// lol no nothing
else return;

View File

@ -26,6 +26,7 @@ public class LobbySetup : MonoBehaviour {
public void Setup(){
PlayerProperties.CreatePlayerHashtable();
GameBoardInstance.instance.ResetGame();
}
// Update is called once per frame