Exemple #1
0
        public void InteractionsUpdate(TimeSpan timeSinceStart, int interactionsDoneSinceStart, ref Queue <CommItem> interactions)
        {
            if (!isInitialized)
            {
                SharedHelper.LogError("Not initialized."); return;
            }

            //Evaluate triggers that represent 'Surprise' for example
            //These triggers evaluate a model and add a new interaction
            foreach (var trigger in ModelTriggers)
            {
                int oldExecuteCount = trigger.TriggeredCount;

                if (trigger is IModelEvaluateTrigger &&
                    (
                        (trigger.IsOneTimeTrigger && trigger.TriggeredCount == 0)
                        ||
                        (!trigger.IsOneTimeTrigger)
                    )
                    )
                {
                    CommItem?newInteraction = ((IModelEvaluateTrigger)trigger).Process(this);

                    if (newInteraction != null)
                    {
                        if (interactions.Peek().Name != newInteraction.Value.Name)
                        {
                            KorraModelHelper.InsertFirstInteractionList(ref interactions, newInteraction.Value);

                            //TODO: this custom code should be moved to another place
                            if (trigger is VideoGameSurpriseTrigger)
                            {
                                FlagsShared.RequestSurpriseExpression = true;
                            }

                            SharedHelper.Log("Trigger executed: '" + trigger.ToString() + "'");
                        }
                    }
                }
            }
        }