Exemplo n.º 1
0
        /// <summary>
        /// Update all events in the list
        /// </summary>
        public void Update(GameTime gameTime)
        {
            if (enable == false)
            {
                return;
            }

            if (gameEventList.Count > 0)
            {
                //  Update game events
                for (int i = 0; i < gameEventList.Count; i++)
                {
                    GameEventBase gameEvent = gameEventList[i];

                    //  Every "gameEvent" keeps getting updated and gets put on a hold
                    //  until the action is executable.
                    if (gameEvent.IsWatingAction)
                    {
                        gameEvent.Update(gameTime);

                        if (gameEvent is GameTimeEvent)
                        {
                            GameTimeEvent timeEvent = gameEvent as GameTimeEvent;

                            //  If the status is in executable position,
                            //  each event will be executed.
                            if (timeEvent.IsExecuteAction())
                            {
                                //  Executes the time event
                                timeEvent.ExecuteAction();
                            }
                        }
                        else if (gameEvent is GameAreaEvent)
                        {
                            GameAreaEvent areaEvent = gameEvent as GameAreaEvent;

                            //  If the status is in executable position,
                            //  each event will be executed.
                            if (areaEvent.IsExecuteAction(targetScene.Position))
                            {
                                areaEvent.ExecuteAction();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Removes a game event from the event manager
 /// </summary>
 public void RemoveEvent(GameEventBase gameEvent)
 {
     gameEventList.Remove(gameEvent);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds a new game event to the event manager
 /// </summary>
 public void AddEvent(GameEventBase gameEvent)
 {
     gameEventList.Add(gameEvent);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Removes a game event from the event manager
 /// </summary>
 public void RemoveEvent(GameEventBase gameEvent)
 {
     gameEventList.Remove(gameEvent);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds a new game event to the event manager
 /// </summary>
 public void AddEvent(GameEventBase gameEvent)
 {
     gameEventList.Add(gameEvent);
 }