/// <summary> /// Updates the list of NPCs, removing dead ones and walking static AIPaths or reacting to the player, /// if they are of the right state /// </summary> /// <param name="time">The GameTime instance with which to make decisions regarding NPC behavior</param> public void updateNpcs(GameTime time) { for (int i = 0; i < npcs.Count; i++) { Npc npc = npcs[i]; if (npc.isDead()) { npc.playEffect(); deadNpcs.Add(npc); npcs.RemoveAt(i); i--; } else { npc.update(time); } } }