public void ReleaseUserControl() { foreach (var obj in OwnedObjects) { InputReceiverSwitch.SetReceiveInput(obj.gameObject, false); } }
void Start() { if (!InputReceiverSwitch.CheckInputActiveInHierarchy(this)) { this.enabled = false; } }
void Update() { // <DEBUG switch item input.> if (Input.GetKeyDown(KeyCode.Q) && Inventory != null && InputReceiverSwitch.CheckInputActiveInHierarchy(this)) { SwitchToNextItem(); } // </DEBUG switch item input.> }
void Start() { configurator = GetComponent <NumberConfigurator> (); if (!InputReceiverSwitch.CheckInputActiveInHierarchy(this)) { this.enabled = false; } }
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. }