IEnumerator ResumeHealthChangesForAMoment() { if (TurnManager.Singleton.PauseHealthChangesDuringTurn) { HealthComponent.ResumeChangesForAll(); yield return(new WaitForSeconds(ResumeHealthChangesDuration)); HealthComponent.PauseChangesForAll(); } }
public void TransferControlToNextPlayer() { if (PauseHealthChangesDuringTurn) { HealthComponent.PauseChangesForAll(); } if (TurningPlayer.Entity != null) { TurningPlayer.Entity.ReleaseUserControl(); } Player firstPickedPlayer = null; Player currentPlayer; bool firstRound = true; do { currentPlayer = TurningPlayer.Entity = GetNextPlayerInTurnQueue(out TurningPlayer.TurnIndex); if (currentPlayer == null) { return; } if (firstPickedPlayer == null) { firstPickedPlayer = currentPlayer; } else { firstRound = false; } TurningUnitInfo turningUnit; if (!turningUnitsByPlayer.TryGetValue(currentPlayer, out turningUnit)) { turningUnit = new TurningUnitInfo(); turningUnitsByPlayer [currentPlayer] = turningUnit; } var currentUnit = turningUnit.Entity = GetNextUnitInTurnQueue(turningUnit, out turningUnit.TurnIndex); if (currentUnit != null) { InputReceiverSwitch.SetReceiveInput(currentUnit.gameObject, true); currentUnit.BroadcastMessage(OnPrepareToStartTurnMessagName, SendMessageOptions.DontRequireReceiver); return; } } while (firstRound || currentPlayer != firstPickedPlayer); // If this line was reached then there were no "turnable" units. }
void OnPrepareToFinishTurn() { if (TurnManager.Singleton.PauseHealthChangesDuringTurn) { if (resumeHealthChangesRoutine != null) { StopCoroutine(resumeHealthChangesRoutine); } HealthComponent.PauseChangesForAll(); } }