public void TryExecute() { SubPhases.GenericSubPhase subphase = Phases.CurrentSubPhase; if (subphase == null) { Console.Write(Type + " command is skipped (subphase is null)", LogTypes.GameCommands, false, "aqua"); return; } else if (subphase.GetType() != SubPhase) { Console.Write(Type + " command is skipped: subphase is " + subphase + " instead of " + SubPhase, LogTypes.GameCommands, false, "aqua"); return; } else if (!subphase.AllowedGameCommandTypes.Contains(Type) && Type != GameCommandTypes.ConfirmCrit) { Console.Write(Type + " command is skipped: " + subphase + " doesn't support this type of commands", LogTypes.GameCommands, false, "aqua"); return; } else if (!subphase.IsReadyForCommands) { Console.Write(Type + " command is skipped: " + subphase + " is not ready for commands", LogTypes.GameCommands, false, "aqua"); return; } Console.Write("Command is executed: " + Type, LogTypes.GameCommands, true, "aqua"); GameController.ConfirmCommand(); Execute(); GameController.CheckExistingCommands(); }
public virtual void TryExecute() { SubPhases.GenericSubPhase subphase = Phases.CurrentSubPhase; if (!IsPreparationCommand || ReplaysManager.Mode == ReplaysMode.Read) { if (subphase == null) { //Debug.Log(Type + " command is skipped (subphase is null)"); return; } else if (subphase.GetType() != SubPhase) { //Debug.Log(Type + " command is skipped: subphase is " + subphase + " instead of " + SubPhase); return; } else if (!subphase.AllowedGameCommandTypes.Contains(Type) && Type != GameCommandTypes.ConfirmCrit) { //Debug.Log(Type + " command is skipped: " + subphase + " doesn't support this type of commands"); return; } else if (!subphase.IsReadyForCommands) { //Debug.Log(Type + " command is skipped: " + subphase + " is not ready for commands"); return; } } GameController.ConfirmCommand(); Console.Write($"Command is executed: {this.GetType().ToString().Replace("GameCommands.", "")}", isBold: true, color: "cyan"); Execute(); }
public void TryExecute() { SubPhases.GenericSubPhase subphase = Phases.CurrentSubPhase; if (subphase != null && subphase.AllowedGameCommandTypes.Contains(Type) && subphase.GetType() == SubPhase && subphase.IsReadyForCommands) { GameController.ConfirmCommand(); Console.Write("Command is executed: " + Type, LogTypes.GameCommands, true, "aqua"); Execute(); GameController.CheckExistingCommands(); } else { if (SubPhase != null) { Console.Write("Command is skipped: " + Type, LogTypes.GameCommands, false, "aqua"); } } }