90 lines
2.1 KiB
C#
90 lines
2.1 KiB
C#
using StgSharp_Game;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StgSharp_Logic
|
|
{
|
|
public class EntityContainer
|
|
{
|
|
private Counter<int> _limit;
|
|
private float _leftBorder;
|
|
private float _rightBorder;
|
|
private float _topBorder;
|
|
private float _bottomBorder;
|
|
private LinkedList _container;
|
|
|
|
public LinkedList Container
|
|
{
|
|
get { return _container; }
|
|
set { _container = value; }
|
|
}
|
|
|
|
public float LeftBorder
|
|
{
|
|
get { return _leftBorder; }
|
|
set { _leftBorder = value; }
|
|
}
|
|
public float RightBorder
|
|
{
|
|
get { return _rightBorder; }
|
|
set { _rightBorder = value; }
|
|
}
|
|
public float TopBorder
|
|
{
|
|
get { return _topBorder; }
|
|
set { _topBorder = value; }
|
|
}
|
|
public float BottomBorder
|
|
{
|
|
get { return _bottomBorder; }
|
|
set { _bottomBorder = value; }
|
|
}
|
|
|
|
public EntityContainer(Counter<int> counter)
|
|
{
|
|
this._limit = counter;
|
|
this.Container = new LinkedList(_limit);
|
|
}
|
|
|
|
public void Add(LinkedTarget target)
|
|
{
|
|
if (true)
|
|
{
|
|
|
|
}
|
|
_container.Add(target);
|
|
}
|
|
|
|
public void RemoveAt(int id)
|
|
{
|
|
_container.Remove(id);
|
|
}
|
|
|
|
//Move an entity from one container to another one
|
|
public void Move(LinkedTarget target, EntityContainer targetContainer)
|
|
{
|
|
target.Previous = target.Next;
|
|
target.Next = target.Previous;
|
|
targetContainer.Add(target);
|
|
|
|
}
|
|
|
|
//What should a container do on each rendering frame
|
|
//This method should be overriden
|
|
public void OnRender()
|
|
{
|
|
//坐标刷新
|
|
//边界判定
|
|
//碰撞判定
|
|
}
|
|
|
|
public void ReportCapacity()
|
|
{
|
|
Console.WriteLine(_limit.Value);
|
|
}
|
|
}
|
|
}
|