private INpcIntelligence TryCreateConfiguredNpcIntelligence(MonsterDefinition monsterDefinition, GameMap createdMap) { if (string.IsNullOrWhiteSpace(monsterDefinition.IntelligenceTypeName)) { return(null); } try { var type = Type.GetType(monsterDefinition.IntelligenceTypeName); if (type == null) { Logger.Error($"Could not find type {monsterDefinition.IntelligenceTypeName}"); return(null); } return((INpcIntelligence)Activator.CreateInstance(type, createdMap)); } catch (Exception ex) { Logger.Error($"Could not create npc intelligence for monster {monsterDefinition.Designation}, type name {monsterDefinition.IntelligenceTypeName}", ex); } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="DroppedItem" /> class. /// </summary> /// <param name="item">The item.</param> /// <param name="position">The position where the item was dropped on the map.</param> /// <param name="map">The map.</param> /// <param name="dropper">The dropper.</param> public DroppedItem(Item item, Point position, GameMap map, Player dropper) : this(item, position, map, dropper, null) { }
/// <summary> /// Initializes a new instance of the <see cref="GameMapEventArgs"/> class. /// </summary> /// <param name="gameMap">The game map.</param> /// <param name="locatable">The locatable object.</param> public GameMapEventArgs(GameMap gameMap, ILocateable locatable) { this.Map = gameMap; this.Object = locatable; }