2012-05-08 03:20:22 +00:00
|
|
|
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;
|
2014-11-29 23:16:46 +00:00
|
|
|
using Gleed2D.InGame;
|
2012-05-08 03:20:22 +00:00
|
|
|
|
2012-05-12 22:54:30 +00:00
|
|
|
namespace Axios.Engine.Gleed2D
|
2012-05-08 03:20:22 +00:00
|
|
|
{
|
2014-11-29 23:16:46 +00:00
|
|
|
public class PathItem : Item
|
2012-05-08 03:20:22 +00:00
|
|
|
{
|
2014-11-29 23:16:46 +00:00
|
|
|
private PathItemProperties _item;
|
|
|
|
|
|
|
|
public PathItemProperties LayerItem
|
|
|
|
{
|
|
|
|
get { return _item; }
|
|
|
|
set { }
|
|
|
|
}
|
2012-05-08 03:20:22 +00:00
|
|
|
|
|
|
|
Body _body;
|
|
|
|
|
2014-11-29 23:16:46 +00:00
|
|
|
public PathItem(PathItemProperties i)
|
2012-05-08 03:20:22 +00:00
|
|
|
{
|
2014-11-29 23:16:46 +00:00
|
|
|
this._item = i;
|
2012-05-08 03:20:22 +00:00
|
|
|
}
|
|
|
|
|
2014-12-31 04:07:05 +00:00
|
|
|
public override void load(AxiosGameScreen gameScreen)
|
2012-05-08 03:20:22 +00:00
|
|
|
{
|
2014-12-31 04:07:05 +00:00
|
|
|
base.load(gameScreen);
|
2014-11-29 23:16:46 +00:00
|
|
|
|
|
|
|
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)));
|
2012-05-08 03:20:22 +00:00
|
|
|
|
2014-11-29 23:16:46 +00:00
|
|
|
_body = BodyFactory.CreateLoopShape(gameScreen.World, v);
|
|
|
|
_body.Position = ConvertUnits.ToSimUnits(this.LayerItem.Position);
|
|
|
|
_body.UserData = this;
|
|
|
|
|
2012-05-08 03:20:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|