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