public MapObject(ObjectDescriptor descriptor, ResourceManager resources, Renderer renderer, Vector position) { SpriteDescriptor spriteDesc = resources.GetSpriteDescriptor(descriptor.Sprites[descriptor.DefaultSprite]); sprite = new Sprite(spriteDesc, resources); Position = new Vector(position); DisplayPosition = new Vector(position); this.renderer = renderer; sprite.PlayAnimation(spriteDesc.DefaultAnimation, true); Name = descriptor.Name; ExtraProperties = new Dictionary<string, string>(); }
private double TryGetDoubleProperty(ObjectDescriptor obj, string prop) { double val = 0; try { val = obj.GetDoubleProperty(prop); } catch (KeyNotFoundException) { val = 0; } return val; }