Files
stgsharp/源代码/StgSharp/Logic/Pool.cs
T

116 lines
3.3 KiB
C#

using Steamworks;
using StgSharp.Math;
using StgSharp.Entities;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Text;
namespace StgSharp
{
public class Pool:INode<Pool>
{
internal LinkedList<Point> pointContainer;
internal LinkedList<IPlainGeometry> geometryContainer;
internal LinkedList<IEntity> _bulletContainer;
internal LinkedList<IEntity> _awardContainer;
internal LinkedList<IEntity> _enemyContainer;
internal Line leftBoader;
internal Line rightBoader;
internal Line topBoader;
internal Line bottomBoader;
public Line LeftBoarder => leftBoader;
public Line RightBoarder => rightBoader;
public Line TopBoarder => topBoader;
public Line BottomBoarder => bottomBoader;
internal Sensor<EntityPartical> Sensor;
#if DEBUG
public Pool()
{
initContainers();
Console.WriteLine("Pool init OK!");
}
#endif
public Pool(Line left, Line right, Line top, Line bottom)
{
initContainers();
topBoader = top;
bottomBoader= bottom;
rightBoader = right;
leftBoader = left;
}
public Pool( Geometries.Rectangle area)
{
vec3d vec = area.vertex01.Position - area.vertex02.Position;
if ((vec.X==0||vec.Y==0)&&vec.Z==0)
{
Line[] barders = area.GetAllSides();
if (area.vertex01.X>0)
{
if (area.vertex01.Y>0)
{
topBoader = barders[3];
rightBoader = barders[0];
bottomBoader = barders[1];
leftBoader = barders[2];
}
else
{
topBoader = barders[2];
rightBoader = barders[3];
bottomBoader = barders[0];
leftBoader = barders[1];
}
}
else
{
if (area.vertex01.Y > 0)
{
topBoader = barders[3];
rightBoader = barders[0];
bottomBoader = barders[1];
leftBoader = barders[2];
}
else
{
topBoader = barders[2];
rightBoader = barders[3];
bottomBoader = barders[0];
leftBoader = barders[1];
}
}
}
initContainers();
}
private void initContainers()
{
_id = new ContainerNode<Pool>(this);
pointContainer = new LinkedList<Point>();
_bulletContainer = new LinkedList<IEntity>();
_awardContainer = new LinkedList<IEntity>();
_enemyContainer = new LinkedList<IEntity>();
}
public void OnRender()
{
foreach (Enemy e in _enemyContainer)
{
}
}
}
}