Пример #1
0
        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>();
        }
Пример #2
0
        private double TryGetDoubleProperty(ObjectDescriptor obj, string prop)
        {
            double val = 0;
            try
            {
                val = obj.GetDoubleProperty(prop);
            }
            catch (KeyNotFoundException)
            {
                val = 0;
            }

            return val;
        }