Ejemplo n.º 1
0
        //Updates Tiles and all NPCs on them
        protected void UpdateNPCs(GameTime gameTime)
        {
            List <NPC> toRemove = new List <NPC>();

            foreach (NPC n in NPCs)
            {
                n.Update(gameTime);

                //Reset any entity which falls down from the map
                if (CheckOutOfMap((int)n.Position.Y) == -1 && n.Alive)
                {
                    n.Reset();
                }

                if (!n.Alive)
                {
                    toRemove.Add(n);
                }
            }

            //Removes dead NPCs
            foreach (NPC n in toRemove)
            {
                if (NPCs.Contains(n))
                {
                    NPCs.Remove(n);
                }
            }
        }
Ejemplo n.º 2
0
 public void DeleteCharacter(Character _character)
 {
     if (_character.IsPlayable == true && PCs.Contains(_character) == true)
     {
         PCs.Remove(_character);
     }
     else if (_character.IsPlayable == false && NPCs.Contains(_character) == true)
     {
         NPCs.Remove(_character);
     }
 }
Ejemplo n.º 3
0
 public void RemoveNPC(NPC npc)
 {
     NPCs.Remove(npc);
 }