private IEnumerator TurnDecision() { GameFlowData.Get().gameState = GameState.BothTeams_Decision; // TODO timebanks GameFlowData.Get().Networkm_willEnterTimebankMode = false; GameFlowData.Get().Networkm_timeRemainingInDecisionOverflow = 0; foreach (ActorData actor in GameFlowData.Get().GetActors()) { var turnSm = actor.gameObject.GetComponent <ActorTurnSM>(); ArtemisServerGameManager.Get().ClearAbilityRequests(actor); actor.AppearAtBoardSquare(actor.TeamSensitiveData_authority.MoveFromBoardSquare); ArtemisServerMovementManager.Get().ClearMovementRequest(actor, true); turnSm.CallRpcTurnMessage((int)TurnMessage.TURN_START, 0); } ArtemisServerMovementManager.Get().UpdateTurn(); ArtemisServerBarrierManager.Get().UpdateTurn(); SharedEffectBarrierManager.Get().UpdateTurn(); Log.Info("TurnDecision"); while (GameFlowData.Get().GetTimeRemainingInDecision() > 0) { Log.Info($"Time remaining: {GameFlowData.Get().GetTimeRemainingInDecision()}"); GameFlowData.Get().CallRpcUpdateTimeRemaining(GameFlowData.Get().GetTimeRemainingInDecision()); yield return(new WaitForSeconds(2)); } }
protected virtual void Awake() { if (instance == null) { instance = this; } foreach (var player in GameFlowData.Get().GetPlayers()) { ActorTurnSM actorTurnSM = player.GetComponent <ActorTurnSM>(); actorTurnSM.OnCmdGUITurnMessageCallback += CmdGUITurnMessage; actorTurnSM.OnCmdRequestCancelActionCallback += CmdRequestCancelAction; ActorController actorController = player.GetComponent <ActorController>(); actorController.OnCmdSelectAbilityRequestCallback += CmdSelectAbilityRequest; } }
protected virtual void OnDestroy() { if (instance == this) { instance = null; } if (GameFlowData.Get() != null) { foreach (var player in GameFlowData.Get().GetPlayers()) { ActorTurnSM actorTurnSM = player.GetComponent <ActorTurnSM>(); if (actorTurnSM != null) { actorTurnSM.OnCmdGUITurnMessageCallback -= CmdGUITurnMessage; } ActorController actorController = player.GetComponent <ActorController>(); if (actorController != null) { actorController.OnCmdSelectAbilityRequestCallback -= CmdSelectAbilityRequest; } } } }