Files
MonoGame.Extended/Source/MonoGame.Extended.Tiled/TiledMapObject.cs
T
Lucas Girouard-StranksandDylan Wilson 9e359fb750 Tiled Rework (#331)
* Tiled Rework

* fix failing tests

* really fix failing tests
2017-01-18 20:46:38 +10:00

52 lines
1.6 KiB
C#

#region
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices.ComTypes;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using MonoGame.Extended.Shapes;
#endregion
namespace MonoGame.Extended.Tiled
{
public abstract class TiledMapObject
{
public int Identifier { get; }
public string Name { get; set; }
public string Type { get; }
public TiledMapProperties Properties { get; }
public bool IsVisible { get; set; }
public float Opacity { get; set; }
public float Rotation { get; set; }
public Vector2 Position { get; }
public IShapeF Shape { get; protected set; }
public float Width { get; }
public float Height { get; }
public SizeF Size => Shape.BoundingRectangle.Size;
public RectangleF BoundingRectangle => Shape.BoundingRectangle;
internal TiledMapObject(ContentReader input)
{
Identifier = input.ReadInt32();
Name = input.ReadString();
Type = input.ReadString();
Position = new Vector2(input.ReadSingle(), input.ReadSingle());
Width = input.ReadSingle();
Height= input.ReadSingle();
Rotation = input.ReadSingle();
IsVisible = input.ReadBoolean();
Properties = new TiledMapProperties();
input.ReadTiledMapProperties(Properties);
}
public override string ToString()
{
return $"{Identifier}";
}
}
}