public void init(string address) { mapState = new MapSelectState(voteables.Length); mapPreview.gameObject.SetActive(false); for (short i = 0; i < voteables.Length; ++i) { mapState.voteables[i] = voteables[i].init(this, i); } ownerControl.isOn = false; ownerControl.interactable = state.isServer; startGame.interactable = false; if (state.isServer) { roomID.text = "Room ID: " + address; SetPlayerConnected(0, true); for (short i = 1; i < 4; i++) { SetPlayerConnected(i, false); } ownerControl.onValueChanged.AddListener(delegate(bool toggleIsOn) { this.mapState.ownerControl = toggleIsOn; SendSync(); }); } }
public void RecieveSync(MapSelectState mapState) { this.mapState.MirrorState(mapState); for (short i = 0; i < 4; ++i) { SetPlayerConnected(i, mapState.connectedPlayers[i]); } ownerControl.isOn = mapState.ownerControl; gui.MapSelectMenu(); }
public void MirrorState(MapSelectState other) { ownerControl = other.ownerControl; currentMapID = other.currentMapID; MapSelect.startGame.interactable = (currentMapID > -1); for (int i = 0; i < 4; ++i) { connectedPlayers[i] = other.connectedPlayers[i]; } for (int i = 0; i < voteables.Length; ++i) { voteables[i].MirrorState(other.voteables[i]); } }
void OnStateStart(MapSelectState startState) { switch (startState) { case MapSelectState.NO_SELECT: ClearAllTile(); return; case MapSelectState.CHARACTER_SELECT: ClearAllTile(); return; case MapSelectState.MOVE_SELECT: isMovable = true; return; case MapSelectState.ACT_RESION_SELECT: return; case MapSelectState.ACT_PLAYING: return; default: return; } }
void OnStateEnd(MapSelectState exitState) { switch (exitState) { case MapSelectState.NO_SELECT: return; case MapSelectState.CHARACTER_SELECT: return; case MapSelectState.MOVE_SELECT: ClearAllTile(); isMovable = false; return; case MapSelectState.ACT_RESION_SELECT: ClearAllTile(); return; case MapSelectState.ACT_PLAYING: return; default: return; } }
public void ChangeState(MapSelectState newState) { if (newState == selectState) return; Debug.Log("State Change:" + selectState + "->" + newState); OnStateEnd(selectState); OnStateStart(newState); selectState = newState; }