A basic event. Consists of a type and a list of strings. The type allows the event manager to know where to send the event. The list of strings gives more specific information about the event. Essentially, the type is an identifier of what type of event this is, and thus an identification of the receivers. The list of strings is essentially a payload for the event.
 /// <summary>
 /// Causes the quest to be completed.
 /// </summary>
 /// <param name="gameReference"></param>
 public override void Initialize(Pantheon gameReference)
 {
     Dictionary<string,string> payload = new Dictionary<string,string>();
     payload.Add("QuestId", questId + "");
     Event closeQuestEvent = new Event("CloseQuest", payload);
     gameReference.EventManager.notify(closeQuestEvent);
 }
 /// <summary>
 /// Notifies the appropriate handlers of an Event.
 /// </summary>
 /// <param name="eventInfo">Information about the event.</param>
 public void notify(Event eventInfo)
 {
     foreach (HandleEvent handler in eventHandlers[eventInfo.Type])
     {
         handler(eventInfo);
     }
 }
        /// <summary>
        /// The event handler function which creates a quest on demand.
        /// </summary>
        /// <param name="eventInfo">The event... with the correct information. Contains the quest name to create.</param>
        public void ActivateQuest(Event eventInfo)
        {
            // For loading the indicated quest
            QuestLoader loadQuest = new QuestLoader();

            // Event info for creating a quest with the Quest Manager
            Event createQuestEvent;

            // Find the quest to load
            foreach (QuestLoader quest in metaLoader.Quests)
            {
                if (quest.QuestTitle.Equals(eventInfo.payload["QuestName"]))
                {
                    loadQuest = quest;
                }
            }

            // Payload for the quest creation event
            Dictionary<string, string> payload = new Dictionary<string, string>();

            // Load the quest info
            payload.Add("QuestInfo", loadQuest.ToString());

            // Load each objective info
            foreach(ObjectiveLoader objective in loadQuest.Objectives)
            {
                payload.Add("Objective" + objective.Id, objective.ToString());
            }

            // Create the create quest event
            createQuestEvent = new Event("CreateQuest", payload);

            // Create the quest
            eventInfo.GameReference.EventManager.notify(createQuestEvent);
        }
        /// <summary>
        /// Notifies the appropriate handlers of an Event.
        /// </summary>
        /// <param name="eventInfo">Information about the event.</param>
        public void notify(Event eventInfo)
        {
            // Inject that global reference non-Bunyaviridae-like thingy
            eventInfo.GameReference = this.GameReference;

            try
            {
                string eventName = null;
                foreach (string name in eventHandlers.Keys)
                {
                    if (eventInfo.Type.Contains(name))
                    {
                        eventName = name;
                    }
                }
                if (eventName != null)
                {
                    foreach (HandleEvent handler in eventHandlers[eventName])
                    {
                        handler(eventInfo);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An unhandled event was encountered for the \"" + eventInfo.Type + "\" type of event.");
                return;
            }
        }
        public override void HandleNotification(Event eventinfo)
        {
            Console.WriteLine("Encountered a " + eventinfo.payload["State"] + " type state");

            if (eventinfo.payload["State"].Equals(targetState))
            {
                Console.WriteLine("Activated");
                state = condition.complete;
            }
        }
        public override void triggerHandler(Event eventInfo)
        {
            // Only execute if active
            if (active)
            {
                Console.WriteLine("BUNNIES!!!!!!!!!!");
                active = false;

                int temp = eventInfo.GameReference.rand.Next(-100, 100);
                int temp2 = eventInfo.GameReference.rand.Next(-100, 100);

                BunnyNPC bunny = new BunnyNPC(this.Location + new Vector2(temp, temp2));
                bunny.Load(eventInfo.GameReference.Content);

                // Spam bunnies
                eventInfo.GameReference.currentLevel.addList.Add("Bunny" + BunnyNPC.counter++, bunny);
            }
        }
        /// <summary>
        /// Notifies the appropriate handlers of an Event.
        /// </summary>
        /// <param name="eventInfo">Information about the event.</param>
        public void notify(Event eventInfo)
        {
            // Inject that global reference non-Bunyaviridae-like thingy
            eventInfo.GameReference = this.GameReference;

            try
            {
                // Useless statement
                if (eventHandlers[eventInfo.Type] == null)
                {
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An unhandled event was encountered for the \"" + eventInfo.Type + "\" type of event.");
                return;
            }

            foreach (HandleEvent handler in eventHandlers[eventInfo.Type])
            {

                handler(eventInfo);
            }
        }
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="firedEvent">The event of the fired thingy.</param>
        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");
        }
        /// <summary>
        /// Updates the interactions between the NPCs and the player,
        /// firing off an event for the DialogueManager to handle.
        /// </summary>
        /// <param name="gameReference">A reference to the entire game.</param>
        private void updateInteractions(Pantheon gameReference)
        {
            // Variable initialization --
            NPCCharacter theClosestDude = null;
            NPCCharacter theCurrentDude;

            string theClosestDudesName = "";

            // Get list of NPCs.
            var activeNPCs = from entity in gameReference.currentLevel.Entities where entity.Key.Contains("Friend") select entity.Key;

            // Cycle through and check the social bubbles of the NPCs.
            foreach (String entityKey in activeNPCs)
            {
                Event resetAlerts = new Event();
                resetAlerts.Type = "InteractionAlert";
                resetAlerts.GameReference = gameReference;
                resetAlerts.payload["EntityKey"] = entityKey;
                resetAlerts.payload["State"] = DialogueManager.STATE_NONE;

                gameReference.EventManager.notify(resetAlerts);

                theCurrentDude = (NPCCharacter)gameReference.currentLevel.Entities[entityKey];

                // INTERSECT, WITH YOUR SPLEEN
                if (this.BoundingBox.Intersects(theCurrentDude.ComfortZone))
                {
                    // If no dude, then he is the dude.
                    if (theClosestDude == null)
                    {
                        theClosestDude = theCurrentDude;
                        theClosestDudesName = entityKey;

                        continue;
                    }
                    // Check to see if we have a new dude.
                    else if (Vector2.Distance(theCurrentDude.ActionPoint, this.ActionPoint) < Vector2.Distance(theClosestDude.ActionPoint, this.ActionPoint))
                    {
                        theClosestDude = theCurrentDude;
                        theClosestDudesName = entityKey;
                    }
                }
            }

            // If there is a closest dude, we need to see if we want to interact with him, if so, shoot the event, if not, shoot the other event to make the bubbles appear on top of his head and into the sky.
            if (theClosestDude != null)
            {
                Event talkWithPeople = new Event();

                talkWithPeople.Type = "NONE";
                talkWithPeople.GameReference = gameReference;
                talkWithPeople.payload = new Dictionary<string,string>();

                talkWithPeople.payload["EntityKey"] = theClosestDudesName;

                if (gameReference.ControlManager.actions.Interact)
                {
                    talkWithPeople.Type = "Interaction";
                    //Button Click sound when you press interaction key in the area of an interaction
                    gameReference.audioManager.playSoundEffect("Button Click");
                }
                else
                {
                    talkWithPeople.Type = "InteractionAlert";
                    talkWithPeople.payload["State"] = DialogueManager.STATE_TALKABLE;
                }

                gameReference.EventManager.notify(talkWithPeople);
            }
        }
Example #10
0
        /// <summary>
        /// Called after the objective has been completed. Performs any transition
        /// events before the quest moves to the next objective.
        /// 
        /// Notably cleans up registered event handlers.
        /// </summary>
        public virtual void WrapUp(Pantheon gameReference)
        {
            HandleEvent eventHandler = this.HandleNotification;
            gameReference.EventManager.unregister(this.EventType, eventHandler);

            Dictionary<string, string> payload = new Dictionary<string, string>();
            payload.Add("ObjectiveName", objectiveName);
            Event eventInfo = new Event("ObjectiveCompleteEvent", payload);
            gameReference.EventManager.notify(eventInfo);
        }
Example #11
0
 /// <summary>
 /// An event handler meant to be registered with the event manager.
 /// </summary>
 /// <param name="eventinfo">The event data passed to the handler</param>
 public virtual void HandleNotification(Event eventinfo)
 {
     state = condition.complete;
 }
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="entityName">The entity to interact with.</param>
        /// <param name="entity">The entity that the dialogue is happening with.</param>
        public void Interact(Event firedEvent)
        {
            string entityName = firedEvent.payload["EntityKey"];
            Entity entity = firedEvent.gameReference.currentLevel.Entities[entityName];

            if (this.currentConversation == null)
            {
                this.StartConversation(entityName, entity);
            }
            else if (((DialogueNode)this.currentConversation[this.currentConversationState]).NextState == 0)
            {
                this.EndConversation();
            }
            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);
            }
        }
Example #13
0
        /// <summary>
        /// Designed to pick up an event creation event and parse it to create a quest.
        /// 
        /// The event type is specifically the CreateQuest event... and it's getting rather
        /// specific in format... so I should document it.
        /// 
        /// Create Quest event has a payload populated by a bunch of objective declaration
        /// pairs. Each objective has a key such as "Objective1" or such. The actual information
        /// shall be in one string and shall be parsed on this side of the event. The information
        /// shall be divided by a semi-colon. The information shall be contained in the following
        /// order:
        ///     * Objective Id (index)
        ///     * Type (Trigger, Speak, Kill)
        ///     * Target (most objectives require a target string for the constructor)
        ///     * Next Objective(s) (list of numeric ids separated by commas)
        ///     * Objective Title
        ///     * Objective Text
        /// 
        /// In addition to the objectives, the payload shall contain a meta-information pair. This
        /// shall be labelled as QuestInfo. The information in QuestInfo is as follows (divided by
        /// semi-colon):
        ///     * Number of Objectives
        ///     * Number(s) of the First Objective(s) (list separated by commas)
        ///     * Quest Title
        /// </summary>
        /// <param name="eventInfo">The event information containing quest information.</param>
        public void AddQuest(Event eventInfo)
        {
            try
            {
                // Try to access the quest type
                string temp = eventInfo.payload["QuestInfo"];

                // Catch any failure to do so
            } catch (System.Collections.Generic.KeyNotFoundException ex)
            {
                Console.Error.WriteLine("Couldn't load the quest type during the quest creation process. (Correct Event Type?)\n"
                    + ex.Message + "\n"
                    + ex.StackTrace);
                return;
            }

            // Begin to create the quest
            Quest buildQuest = new Quest();

            // Find the size of the objective list
            string[] questInfo = eventInfo.payload["QuestInfo"].Split(';');

            // Get the number of objectives
            int numberObjectives = Int32.Parse(questInfo[0]);

            // Build the list of objectives
            List<Objective> buildList = new List<Objective>();
            for (int i = 0; i < numberObjectives; i++)
            {
                // Make an empty list to hold all the objectives
                buildList.Add(null);
            }

            // Get the initial objectives
            string[] firstIds = questInfo[1].Split(',');
            int[] firstObjectives = new int[firstIds.Length];
            for (int i = 0; i < firstIds.Length; i++)
            {
                firstObjectives[i] = Int32.Parse(firstIds[i]);
            }

            string questName = questInfo[2];

            // More LINQ magix (Thank you MSDN... I has bad memory)
            var objectives = from objectiveKey in eventInfo.payload.Keys
                             where objectiveKey.Contains("Objective")
                             select objectiveKey;

            Console.WriteLine("Creating quest: " + questName);

            // Create each objective as appropriate
            foreach(string objective in objectives)
            {
                // Parse the elements of the objectives parameters
                string[] objectiveParameters = eventInfo.payload[objective].Split(';');

                // Get the index
                int objectiveId = Int32.Parse(objectiveParameters[0]);

                // Get the type
                string objectiveType = objectiveParameters[1];

                // Get the target
                string objectiveTarget = objectiveParameters[2];

                // Get the next targets
                string[] nextIds = objectiveParameters[3].Split(',');
                int[] nextObjectives = new int[nextIds.Length];
                for (int i = 0; i < nextObjectives.Length; i++)
                {
                    nextObjectives[i] = Int32.Parse(nextIds[i]);
                }

                // Get the objective name
                string objectiveName = objectiveParameters[4];

                // Get the objective text
                string objectiveText = objectiveParameters[5];

                // Decide which objective type to build
                switch (objectiveType)
                {
                    case "Trigger":
                        buildList[objectiveId] = new TriggerObjective(objectiveTarget, objectiveId);
                        buildList[objectiveId].nextObjectives = new List<int>(nextObjectives);

                        break;
                    case "Speak":
                        buildList[objectiveId] = new SpeakObjective(objectiveTarget, objectiveId);
                        buildList[objectiveId].nextObjectives = new List<int>(nextObjectives);

                        break;
                    case "Kill":
                        buildList[objectiveId] = new KillObjective(objectiveTarget, objectiveId);
                        buildList[objectiveId].nextObjectives = new List<int>(nextObjectives);

                        break;
                    case "Win":
                        buildList[objectiveId] = new WinObjective(objectiveId, quests.Count);
                        buildList[objectiveId].nextObjectives = new List<int>(nextObjectives);

                        break;
                    default:
                        break;
                }

                Console.WriteLine("  Adding objective: " + objectiveName);

                buildList[objectiveId].ObjectiveName = objectiveName;
                buildList[objectiveId].ObjectiveText = objectiveText;
            }

            // Set the objective list of the quest
            buildQuest.objectives = buildList;

            // Set the current objectives of the quest
            for (int i = 0; i < firstObjectives.Length; i++)
            {
                Console.WriteLine("Setting current objective: " + firstObjectives[i]);

                buildQuest.setCurrentObjective(firstObjectives[i]);
            }

            // Set the quest name
            buildQuest.QuestTitle = questName;

            // Initialize the quest
            buildQuest.Initialize(eventInfo.GameReference);

            // Add the quest to the current quests
            quests.Add(buildQuest);
        }
Example #14
0
        /// <summary>
        /// Removes a quest because it is complete.
        /// </summary>
        /// <param name="eventInfo">Contains the information on which quest is complete.</param>
        public void CompleteQuest(Event eventInfo)
        {
            Dictionary<string, string> payload = new Dictionary<string, string>();
            payload.Add("QuestName", eventInfo.GameReference.QuestManager.quests[Int32.Parse(eventInfo.payload["QuestId"])].QuestTitle);
            Event questCompleteEvent = new Event("QuestComplete", payload);
            eventInfo.GameReference.EventManager.notify(questCompleteEvent);

            // Remove the complete quest
            quests[Int32.Parse(eventInfo.payload["QuestId"])].DeletionFlag = true;
            //quests.RemoveAt(Int32.Parse(eventInfo.payload["QuestId"]));
        }
Example #15
0
        /// <summary>
        /// Loads the level from a descriptive script file on the harddrive.
        /// </summary>
        public void Load(string newLevel, string oldLevel, Pantheon gameReference)
        {
            levelMap = gameReference.Content.Load<Map>(newLevel);
            levelNum = newLevel;

            this.entities.Add("character", gameReference.player);
            this.entities["character"].Load(gameReference.Content);

            // If the dialogue manager doesn't exist, create it.
            this.dialogueManager = new DialogueManager(gameReference, gameReference.Content.Load<SpriteFont>("Fonts/DialogueFont"));

            // This spawns the character in the right place in the map.
            foreach (MapObject obj in levelMap.ObjectLayers["Spawn"].MapObjects)
            {
                if (obj.Name.Substring(0, 5) == "start" && obj.Name.Substring(5) == oldLevel.Substring(5))
                {
                    this.entities["character"].Location = new Vector2(obj.Bounds.Center.X, obj.Bounds.Center.Y);
                }
                if (obj.Name.Contains("Friend"))
                {
                    this.entities.Add(obj.Name, new OldManFriend(new Vector2(obj.Bounds.Center.X, obj.Bounds.Center.Y)));
                    this.entities[obj.Name].Load(gameReference.Content);
                }
                if (obj.Name.Contains("Enemybutterfly"))
                {
                    this.entities.Add(obj.Name, new ButterflyEnemy(new Vector2(obj.Bounds.Center.X, obj.Bounds.Center.Y), gameReference.Content));
                    this.entities[obj.Name].Load(gameReference.Content);
                }
                if (obj.Name.Contains("Enemybooger"))
                {
                    this.entities.Add(obj.Name, new BoogerShooterEnemy(new Vector2(obj.Bounds.Center.X, obj.Bounds.Center.Y), gameReference.Content));
                    this.entities[obj.Name].Load(gameReference.Content);
                }
                if (obj.Name.Contains("BunnyTrigger"))
                {
                    this.entities.Add(obj.Name, new BunnyTrigger(new Rectangle(obj.Bounds.Left, obj.Bounds.Top, obj.Bounds.Width, obj.Bounds.Height), gameReference));
                    this.entities[obj.Name].Load(gameReference.Content);
                    ((Trigger)this.entities[obj.Name]).ReactivateTime = (int)obj.Properties["ReactivateTime"].AsInt32;
                }
                else if (obj.Name.Contains("Trigger"))
                {
                    this.entities.Add(obj.Name, new Trigger(new Rectangle(obj.Bounds.Left, obj.Bounds.Top, obj.Bounds.Width, obj.Bounds.Height), gameReference));
                    this.entities[obj.Name].Load(gameReference.Content);
                    ((Trigger)this.entities[obj.Name]).ReactivateTime = (int)obj.Properties["ReactivateTime"].AsInt32;
                    ((Trigger)this.entities[obj.Name]).Type = obj.Properties["Type"].Value;
                    // Don't ask... I'm just registering an event handler...
                    gameReference.EventManager.register("Activate" + obj.Name, new HandleEvent(((Trigger)this.entities[obj.Name]).triggerHandler));
                }

                if (obj.Name == "LvlInfo")
                {
                    Console.WriteLine("Found Level Information");
                    try
                    {
                        if (obj.Properties.Keys.Contains("DialogPath"))
                        {
                            DialogueLoader dialogueLoader = gameReference.Content.Load<DialogueLoader>(obj.Properties["DialogPath"].Value);

                            Console.WriteLine("DialogPath Found");
                            this.dialogueManager.Load(dialogueLoader.Conversations);
                        }
                    }
                    catch (Exception except)
                    {
                        Console.Error.WriteLine("Could not load the dialogue properly: " + except.Message);
                    }

                    try
                    {
                        if (obj.Properties.Keys.Contains("QuestPath"))
                        {
                            QuestMetaLoader METALoader = gameReference.Content.Load<QuestMetaLoader>(obj.Properties["QuestPath"].Value);

                            Console.WriteLine("QuestPath Found");

                            for (int x = 0; x < METALoader.Quests.Count; x++)
                            {
                                var questIn = from quest in gameReference.QuestManager.quests
                                              where quest.QuestTitle.Equals(METALoader.Quests.ElementAt(x).QuestTitle)
                                              select quest.QuestTitle;
                                bool found = false;
                                foreach (string name in questIn)
                                {
                                    found = true;
                                }
                                if (!found)
                                {
                                    // Load the quest creator
                                    this.questCreator = new QuestCreator(METALoader, gameReference);
                                }
                            }
                        }
                    }
                    catch (Exception except)
                    {
                        Console.Error.WriteLine("Could not load the quests properly: " + except.Message);
                    }

                    try
                    {
                        if (obj.Properties.Keys.Contains("InitialQuest"))
                        {
                            var questIn = from quest in gameReference.QuestManager.quests
                                          where quest.QuestTitle.Equals(obj.Properties["InitialQuest"].Value)
                                          select quest.QuestTitle;
                            bool found = false;
                            foreach (string name in questIn)
                            {
                                found = true;
                            }
                            if (!found)
                            {
                                // Load the test quest
                                Dictionary<string, string> payload = new Dictionary<string, string>();
                                payload.Add("QuestName", obj.Properties["InitialQuest"].Value);
                                Event eventInfo = new Event("ActivateQuest", payload);
                                gameReference.EventManager.notify(eventInfo);
                            }
                            Console.WriteLine("InitialQuest Found");
                        }
                    }
                    catch (Exception except)
                    {
                        Console.Error.WriteLine("Could not load the initial quest properly: " + except.Message);
                    }
                }
            }
            Camera.Pos = new Vector2(this.entities["character"].DrawingBox.X + entities["character"].DrawingBox.Width / 2,
                    this.entities["character"].DrawingBox.Y + entities["character"].DrawingBox.Height / 2);
            // This is a fairly ugly way of making the tiles draw in the right locations.
            screenRect.X = (int)Camera.Pos.X - gameReference.GraphicsDevice.Viewport.Width / 2;
            if (screenRect.X < 0) screenRect.X = 0;
            screenRect.Y = (int)Camera.Pos.Y - gameReference.GraphicsDevice.Viewport.Height / 2;
            if (screenRect.Y < 0) screenRect.Y = 0;
            screenRect.Width = (int)Camera.Pos.X + gameReference.GraphicsDevice.Viewport.Width / 2;
            screenRect.Height = (int)Camera.Pos.Y + gameReference.GraphicsDevice.Viewport.Height / 2;

            gameReference.CutsceneManager.PlayLevelLoad(gameReference);

            // Load the dialogue manager...
            if (this.dialogueManager == null)
                throw new NullReferenceException("Could not load the dialogue manager, or reference to dialogue XML is MISSING.", null);

            gameReference.audioManager.playBackgroundMusic(levelNum);
        }
        /// <summary>
        /// Handles an event for an interaction alert, such as a "close poximity" alert or a flagged NPC.
        /// </summary>
        /// <param name="firedEvent">The incoming event.</param>
        protected void interactAlert(Event firedEvent)
        {
            string entityName = firedEvent.payload["EntityKey"];
            Entity entity = firedEvent.GameReference.currentLevel.Entities[entityName];

            try
            {
                if (this.npcStates[entityName] == DialogueManager.STATE_TALKING) return;

                if (this.conversations.Keys.Contains(entityName))
                {
                    this.npcStates[entityName] = firedEvent.payload["State"];
                }
                else
                {
                    this.npcStates.Add(entityName, firedEvent.payload["State"]);
                }
            }
            catch (KeyNotFoundException e)
            {
                //Console.Error.WriteLine("No NPC found for interaction alert.");
            }
        }
        /// <summary>
        /// Adds the ability for spontaneous conversation, such as timed text boxes or temporary text boxes.
        /// </summary>
        /// <param name="firedEvent">The incoming event.</param>
        protected void spontaneousConversation(Event firedEvent)
        {
            string entityName = firedEvent.payload["EntityKey"];
            Entity entity = firedEvent.GameReference.currentLevel.Entities[entityName];

            if (this.npcStates[entityName] == DialogueManager.STATE_TALKING) return;

            if (this.conversations.Keys.Contains(entityName))
            {
                this.npcStates[entityName] = DialogueManager.STATE_SPONTANEOUS;
                this.npcStateBubbles[entityName].isReadyForDeletion = true;
                this.npcStateBubbles[entityName] = new TextBubble(entity, firedEvent.payload["Text"]);
            }
        }
        public override void HandleNotification(Event eventinfo)
        {
            base.HandleNotification(eventinfo);

            Console.WriteLine(eventinfo.payload["Entity"] + " has collided with " + TargetTrigger + "\nObjective Complete!");
        }
        /// <summary>
        /// The function that shall respond to the stuff... yep
        /// </summary>
        /// <param name="eventinfo">The information about the stuff that's happened.</param>
        public override void HandleNotification(Event eventinfo)
        {
            base.HandleNotification(eventinfo);

            Console.WriteLine("You killed the arch enemy of evilness... you monster!");
        }
Example #20
0
 /// <summary>
 /// The handler for the Trigger which will be registered to an event with the same name as the trigger.
 /// </summary>
 /// <param name="eventInfo">The general event information structure.</param>
 public virtual void triggerHandler(Event eventInfo)
 {
     // Create the event that corresponds to the trigger type
     eventInfo.GameReference.EventManager.notify(new Event(type, eventInfo.payload));
 }