Ejemplo n.º 1
0
        public override bool Evaluate(MessageCenterMessage message, string responseName)
        {
            base.Evaluate(message, responseName);
            EncounterObjectStateChangeMessage encounterMessage = message as EncounterObjectStateChangeMessage;

            // Main.LogDebug("[EncounterObjectMatchesStateConditional] Evaluating...");

            if (State == EncounterObjectStatus.Nothing)
            {
                Main.Logger.LogError($"[EncounterObjectMatchesStateConditional] Trying to use this conditional without setting State to check against. You must set state.");
                return(false);
            }

            if (encounterMessage != null && encounterMessage.EncounterGuid == this.EncounterGuid)
            {
                base.LogEvaluationPassed("[EncounterObjectMatchesStateConditional] Encounter guid matches guid of message.", responseName);

                if (encounterMessage.State == this.State)
                {
                    Main.LogDebug($"[EncounterObjectMatchesStateConditional] Encounter guid and State matched for '{responseName}'");
                    return(true);
                }
            }

            // Main.LogDebug($"[EncounterObjectMatchesStateConditional] Encounter guid and/or State did NOT match for '{responseName}'");
            base.LogEvaluationFailed("[EncounterObjectMatchesStateConditional] Encounter guid did NOT match guid of message.", responseName);
            return(false);
        }
        static void Prefix(EncounterObjectGameLogic __instance, EncounterObjectStatus status)
        {
            EncounterObjectStateChangeMessage message = new EncounterObjectStateChangeMessage(__instance.encounterObjectGuid, status);

            UnityGameInstance.BattleTechGame.Combat.MessageCenter.PublishMessage(message);
        }