PantheonPrototype.DialogueManager.interact C# (CSharp) Method

interact() protected method

Is used to interact with NPCs. If there is no conversation going, it will initialize one. If the end of a conversation has been reached, it will end the conversation.
protected interact ( Event firedEvent ) : void
firedEvent Event The event of the fired thingy.
return void
        protected void interact(Event firedEvent)
        {
            string entityName = firedEvent.payload["EntityKey"];
            Entity entity = firedEvent.GameReference.currentLevel.Entities[entityName];

            if (this.conversations.Keys.Contains(firedEvent.payload["EntityKey"]))
            {
                if (this.currentConversation == null)
                {
                    this.StartConversation(entityName, entity);
                }
                else if (((DialogueNode)this.currentConversation[this.currentConversationState]).NextState == 0)
                {
                    this.EndConversation(entityName);
                }
                else
                {
                    DialogueNode currentDiagNode = (DialogueNode)this.currentConversation[this.currentConversationState];

                    this.currentConversationBubble.isReadyForDeletion = true;
                    this.currentConversationState = currentDiagNode.NextState;

                    currentDiagNode = (DialogueNode)this.currentConversation[this.currentConversationState];

                    this.currentConversationBubble = new TextBubble(entity, currentDiagNode.Text);
                    this.activeTextBubbles.AddLast(this.currentConversationBubble);
                }

                if (this.currentConversation != null)
                {
                    Event newEvent = new Event();

                    newEvent.GameReference = firedEvent.GameReference;
                    newEvent.Type = firedEvent.payload["EntityKey"] + "Speaking";
                    newEvent.payload.Add("State", "" + this.currentConversationState);

                    firedEvent.GameReference.EventManager.notify(newEvent);
                }
            }
            else
                Console.WriteLine("ENTITY[" + firedEvent.payload["EntityKey"] + "] HAS NO DIALOGUE");
        }