Beispiel #1
0
        public ObjectInstance(SerializationInfo info, StreamingContext context)
        {
            _uid = (Guid)info.GetValue("Uid", typeof(Guid));
            _classId = (Guid)info.GetValue("ClassID", typeof(Guid));
            _posX = info.GetInt32("PosX");
            _posY = info.GetInt32("PosY");
            _rotation = info.GetSingle("Rotation");
            _scaleX = info.GetSingle("ScaleX");
            _scaleY = info.GetSingle("ScaleY");

            _predefinedProperties = new ObjectInstanceProperties(this);
            _properties = info.GetValue("Properties", typeof(PropertyCollection)) as PropertyCollection;
        }
Beispiel #2
0
        public ObjectInstance(ObjectClass objClass, int posX, int posY)
        {
            _uid = Guid.NewGuid();
            _class = objClass;
            _posX = posX;
            _posY = posY;
            _rotation = 0;
            _scaleX = 1f;
            _scaleY = 1f;

            _properties = new PropertyCollection(_reservedPropertyNames);
            _properties.Modified += (s, e) => OnModified(EventArgs.Empty);

            _predefinedProperties = new ObjectInstanceProperties(this);

            UpdateBounds();
        }