Esempio n. 1
0
        protected override void ReadObjectTag(Level creationLevel_DC, XmlReader reader, LevelObject levObject_DC)
        {
            SLLevelObject levObject     = levObject_DC as SLLevelObject;
            SLLevel       creationLevel = creationLevel_DC as SLLevel;

            base.ReadObjectTag(creationLevel_DC, reader, levObject_DC);

            levObject.Pos = new Point((double)levObject.ObjectPosX * creationLevel.TileSize, (double)levObject.ObjectPosY * creationLevel.TileSize);

            reader.MoveToAttribute("offsetY");
            levObject.OffsetY = Double.Parse(reader.Value);

            reader.MoveToAttribute("filename");
            levObject.ObjectImage = SnakeUtils.LoadImage(reader.Value);

            levObject.ObjectImage.SetValue(Canvas.LeftProperty, levObject.Pos.X);
            levObject.ObjectImage.SetValue(Canvas.TopProperty, levObject.Pos.Y + levObject.OffsetY);
            creationLevel.LevelCanvas.Children.Add(levObject.ObjectImage);
        }