small fixes
This commit is contained in:
parent
928a5e9cef
commit
5164182edb
|
@ -772,6 +772,8 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
|
||||||
|
|
||||||
render.SetAnimation();
|
render.SetAnimation();
|
||||||
|
|
||||||
|
render.RenderName();
|
||||||
|
|
||||||
render.SetComboLevel(Combo);
|
render.SetComboLevel(Combo);
|
||||||
render.SetScoreValue(score);
|
render.SetScoreValue(score);
|
||||||
|
|
||||||
|
@ -790,6 +792,20 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
|
||||||
Register();
|
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(){
|
public void Setup(){
|
||||||
board = BoardStateExtension.Initialize();
|
board = BoardStateExtension.Initialize();
|
||||||
|
|
||||||
|
@ -802,19 +818,7 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
|
||||||
lastActivatorColor = TileInfo.CreateRandomActivatorTile().color;
|
lastActivatorColor = TileInfo.CreateRandomActivatorTile().color;
|
||||||
|
|
||||||
// Texel - Ooops we forgot to clear these
|
// Texel - Ooops we forgot to clear these
|
||||||
trashCursorHead = 0;
|
ResetGame();
|
||||||
incomingTrash = 0;
|
|
||||||
score = 0;
|
|
||||||
|
|
||||||
render.RenderName();
|
|
||||||
|
|
||||||
nextActivator = TilesUntilActivator;
|
|
||||||
nextSpecial = ActivatorsUntilSpecial;
|
|
||||||
delayState = DelayState.None;
|
|
||||||
timeInState = 0;
|
|
||||||
|
|
||||||
CurrentDrop = 0;
|
|
||||||
NextDrop = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartGame(){
|
public void StartGame(){
|
||||||
|
|
|
@ -66,8 +66,7 @@ public class GameBoardInstance : MonoBehaviour {
|
||||||
case 1:
|
case 1:
|
||||||
case -2:
|
case -2:
|
||||||
GameTransition.Instance.state = GameState.Lobby;
|
GameTransition.Instance.state = GameState.Lobby;
|
||||||
player1.Clear();
|
ClearGame();
|
||||||
player2.Clear();
|
|
||||||
break;
|
break;
|
||||||
// rematch
|
// rematch
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -76,19 +75,27 @@ public class GameBoardInstance : MonoBehaviour {
|
||||||
// disconnected
|
// disconnected
|
||||||
case -3:
|
case -3:
|
||||||
GameTransition.Instance.state = GameState.Menu;
|
GameTransition.Instance.state = GameState.Menu;
|
||||||
player1.Clear();
|
ClearGame();
|
||||||
player2.Clear();
|
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetGame(){
|
||||||
|
player1.ResetGame();
|
||||||
|
player2.ResetGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearGame(){
|
||||||
|
player1.Clear();
|
||||||
|
player2.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void SetupGame(){
|
public void SetupGame(){
|
||||||
System.Action callback;
|
System.Action callback;
|
||||||
|
|
||||||
player1.Clear();
|
ClearGame();
|
||||||
player2.Clear();
|
|
||||||
|
|
||||||
if (NetworkManager.inRoom){
|
if (NetworkManager.inRoom){
|
||||||
var players = NetworkManager.net.CurrentRoom.Players.Values.OrderBy(p => p.ID);
|
var players = NetworkManager.net.CurrentRoom.Players.Values.OrderBy(p => p.ID);
|
||||||
|
@ -164,8 +171,7 @@ public class GameBoardInstance : MonoBehaviour {
|
||||||
player1.Stop();
|
player1.Stop();
|
||||||
player2.Stop();
|
player2.Stop();
|
||||||
|
|
||||||
player1.Clear();
|
ClearGame();
|
||||||
player2.Clear();
|
|
||||||
|
|
||||||
if (NetworkManager.inRoom){
|
if (NetworkManager.inRoom){
|
||||||
NetworkManager.net.OpLeaveRoom();
|
NetworkManager.net.OpLeaveRoom();
|
||||||
|
|
|
@ -55,6 +55,10 @@ public class GameBoardRender : MonoBehaviour {
|
||||||
index = board.delayState == GameBoard.DelayState.Loss ? 2 : 1;
|
index = board.delayState == GameBoard.DelayState.Loss ? 2 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// lobby edge case
|
||||||
|
else if (GameTransition.Instance.state == GameState.Lobby){
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
// lol no nothing
|
// lol no nothing
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class LobbySetup : MonoBehaviour {
|
||||||
|
|
||||||
public void Setup(){
|
public void Setup(){
|
||||||
PlayerProperties.CreatePlayerHashtable();
|
PlayerProperties.CreatePlayerHashtable();
|
||||||
|
GameBoardInstance.instance.ResetGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
Loading…
Reference in New Issue