Files
stgsharp/源代码/StgSharp/Entities/Entity.cs
T

72 lines
1.7 KiB
C#

using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public class Entity:INode<Entity>
{
internal vec2d _pos;
internal IGeometry _collisionBox;
internal Sensor<IGeometry> _collisionSensor;
internal ContainerNode<Entity> _id;
public IGeometry CollisionBox
{
get { return _collisionBox; }
set { _collisionBox = value; }
}
/// <summary>
/// A sensor used for cheking out if a bullet hit a player or something else
/// </summary>
public Sensor<IGeometry> CollisionSensor
{
get { return _collisionSensor; }
set { _collisionSensor = value; }
}
public string Texture { get; set; }
/// <summary>
/// A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
/// </summary>
public vec2d Location { get; }
/// <summary>
/// X position of an enenmy entity
/// </summary>
public float X { get; set; }
/// <summary>
/// Y position of an enemy entity
/// </summary>
public float Y { get; set; }
ContainerNode<Entity> INode<Entity>.ID
{
get { return _id; }
}
public void SetLocation(Point p)
{
}
void INode<Entity>.setID<T>(ContainerNode<T> id)
{
if (id == null)
{
_id = id as ContainerNode<Entity>;
}
else
{
throw new ArgumentException("Cannot set id twice!");
}
}
}
}