axiosengine/axios/Engine/Gleed2D/PathItem.cs
Nathan Adams dfea1994f0 * 1.0.1.9 - 5/20/2013
* - Adding mono support
 *
 * 1.0.1.10 - 11/29/2014
 * - Adding prompt factory class to generate a Final Fantasy type text prompt
 * - Updating Gleed2D support to work with latest version of Gleed2D
2014-11-29 17:16:46 -06:00

49 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Common;
using FarseerPhysics.SamplesFramework;
using FarseerPhysics.Factories;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Gleed2D.InGame;
namespace Axios.Engine.Gleed2D
{
public class PathItem : Item
{
private PathItemProperties _item;
public PathItemProperties LayerItem
{
get { return _item; }
set { }
}
Body _body;
public PathItem(PathItemProperties i)
{
this._item = i;
}
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
{
base.load(gameScreen, ref cache);
Vertices v = new Vertices(LayerItem.LocalPoints.Count);
foreach (Vector2 vec in LayerItem.LocalPoints)
v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y)));
_body = BodyFactory.CreateLoopShape(gameScreen.World, v);
_body.Position = ConvertUnits.ToSimUnits(this.LayerItem.Position);
_body.UserData = this;
}
}
}