Daily update on 20221031 by Nitload Youmu
This commit is contained in:
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -33,6 +33,14 @@ namespace StgSharp.Entity
|
||||
set { _y = value; }
|
||||
}
|
||||
|
||||
private float _radius;
|
||||
|
||||
public float Radius
|
||||
{
|
||||
get { return _radius; }
|
||||
set { _radius = value; }
|
||||
}
|
||||
|
||||
public Bullet()
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
using StgSharp.Logic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometry
|
||||
{
|
||||
internal class FreeCurve : LinkedObject, IGeometry
|
||||
{
|
||||
|
||||
private IPoint _center;
|
||||
private float[] _xExpression;
|
||||
private float[] _yExpression;
|
||||
|
||||
public float[] XExpression
|
||||
{
|
||||
get { return _xExpression; }
|
||||
set { _xExpression = value; }
|
||||
}
|
||||
|
||||
public float[] YExpression
|
||||
{
|
||||
get { return _yExpression; }
|
||||
set { _yExpression = value; }
|
||||
|
||||
}
|
||||
|
||||
public IPoint Center
|
||||
{
|
||||
get { return _center; }
|
||||
set { _center = value; }
|
||||
}
|
||||
|
||||
public event ComplexOperationHandler ComplexOperation;
|
||||
|
||||
|
||||
|
||||
public FreeCurve(IPoint c, float[] x, float[] y)
|
||||
{
|
||||
if (x.Length==10)
|
||||
{
|
||||
_xExpression = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Parameters are too many or too few!");
|
||||
}
|
||||
|
||||
if (y.Length==10)
|
||||
{
|
||||
_yExpression = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Parameters are too many or too few!");
|
||||
}
|
||||
}
|
||||
|
||||
public void Bind(IPoint p)
|
||||
{
|
||||
_center = p;
|
||||
}
|
||||
|
||||
public void OnRender()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,13 @@ namespace StgSharp.Logic
|
||||
protected LinkedObject _cache;
|
||||
protected Counter<uint> _amountCounter;
|
||||
|
||||
public LinkedObject Heading
|
||||
public virtual LinkedObject Heading
|
||||
{
|
||||
get { return _heading; }
|
||||
set { _heading = value; }
|
||||
}
|
||||
|
||||
public LinkedObject Ending
|
||||
public virtual LinkedObject Ending
|
||||
{
|
||||
get { return _ending; }
|
||||
set { _ending = value; }
|
||||
@@ -44,7 +44,7 @@ namespace StgSharp.Logic
|
||||
}
|
||||
|
||||
|
||||
public void Add(LinkedObject target)
|
||||
public virtual void Add(LinkedObject target)
|
||||
{
|
||||
if (_ending != null)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
using StgSharp.Entity;
|
||||
using StgSharp.Logic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Pool
|
||||
{
|
||||
internal class BulletContainer : LinkedList, IContainer
|
||||
{
|
||||
private int _limit;
|
||||
protected float _leftBorder;
|
||||
protected float _rightBorder;
|
||||
protected float _topBorder;
|
||||
protected float _bottomBorder;
|
||||
|
||||
public int Limit
|
||||
{
|
||||
get { return _limit; }
|
||||
set { _limit = 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 static IContainer _top;
|
||||
public static IContainer _bottom;
|
||||
public static IContainer _left;
|
||||
public static IContainer _right;
|
||||
|
||||
public IContainer Top
|
||||
{
|
||||
get { return _top; }
|
||||
set { }
|
||||
}
|
||||
public IContainer Bottom
|
||||
{
|
||||
get { return _bottom; }
|
||||
set { }
|
||||
}
|
||||
public IContainer Left
|
||||
{
|
||||
get { return _left; }
|
||||
set { }
|
||||
}
|
||||
public IContainer Right
|
||||
{
|
||||
get { return _right; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public BulletContainer(float top, float bottom, float left, float right)
|
||||
{
|
||||
_topBorder = top;
|
||||
_bottomBorder = bottom;
|
||||
_leftBorder = left;
|
||||
_rightBorder = right;
|
||||
this._amountCounter = new Counter<uint>();
|
||||
_amountCounter.Value = 0;
|
||||
_heading = null;
|
||||
}
|
||||
|
||||
public BulletContainer(IContainer t, IContainer b, IContainer l, IContainer r)
|
||||
{
|
||||
_top = t;
|
||||
_topBorder = t.BottomBorder;
|
||||
|
||||
_bottom = b;
|
||||
_bottomBorder = b.TopBorder;
|
||||
|
||||
_left = l;
|
||||
_leftBorder = l.RightBorder;
|
||||
|
||||
_right = r;
|
||||
_rightBorder = r.LeftBorder;
|
||||
}
|
||||
|
||||
//What should a container do on each rendering frame
|
||||
//This method should be overriden
|
||||
public void OnRender()
|
||||
{
|
||||
//坐标刷新
|
||||
//边界判定
|
||||
//碰撞判定
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -40,15 +40,15 @@ namespace StgSharp.Pool
|
||||
|
||||
//用一个实体容器存放各种各样的实体,太不安全了,
|
||||
//写这种代码的人是个大SB。
|
||||
static EntityContainer mainContainer;
|
||||
static EntityContainer grazeContainer;
|
||||
static BulletContainer mainContainer;
|
||||
static BulletContainer grazeContainer;
|
||||
|
||||
|
||||
public BulletPool(Collector t, Collector b, Collector l, Collector r)
|
||||
{
|
||||
mainContainer = new EntityContainer(1000,-1000,-600,600);
|
||||
mainContainer = new BulletContainer(1000,-1000,-600,600);
|
||||
|
||||
grazeContainer = new EntityContainer(1000,400,-150,150);
|
||||
grazeContainer = new BulletContainer(1000,400,-150,150);
|
||||
|
||||
mainContainer.Top = _topCollector;
|
||||
mainContainer.Bottom = _bottomCollector;
|
||||
@@ -70,7 +70,21 @@ namespace StgSharp.Pool
|
||||
|
||||
public static void OnRender()
|
||||
{
|
||||
cache = mainContainer.Heading;
|
||||
Bullet end=mainContainer.Ending as Bullet;
|
||||
cache = mainContainer.Heading as Bullet;
|
||||
do
|
||||
{
|
||||
if (cache.X - cache.Radius < grazeContainer.LeftBorder
|
||||
|| cache.X + cache.Radius < grazeContainer.RightBorder
|
||||
|| cache.Y - cache.Radius < grazeContainer.TopBorder
|
||||
|| cache.Y + cache.Radius < grazeContainer.RightBorder)
|
||||
{
|
||||
grazeContainer.Add(cache);
|
||||
}
|
||||
|
||||
cache = cache.Next as Bullet;
|
||||
|
||||
} while (cache == end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace StgSharp.Logic
|
||||
{
|
||||
|
||||
private int _limit;
|
||||
private float _leftBorder;
|
||||
private float _rightBorder;
|
||||
private float _topBorder;
|
||||
private float _bottomBorder;
|
||||
protected float _leftBorder;
|
||||
protected float _rightBorder;
|
||||
protected float _topBorder;
|
||||
protected float _bottomBorder;
|
||||
|
||||
public int Limit
|
||||
{
|
||||
|
||||
@@ -52,10 +52,12 @@
|
||||
<Compile Include="Entity\Enemy.cs" />
|
||||
<Compile Include="Game\CoreInfo.cs" />
|
||||
<Compile Include="Control\ComplexOperationHandler.cs" />
|
||||
<Compile Include="Geometry\FreeCurve.cs" />
|
||||
<Compile Include="Geometry\IGeometry.cs" />
|
||||
<Compile Include="Geometry\IPoint.cs" />
|
||||
<Compile Include="Geometry\PointCommon.cs" />
|
||||
<Compile Include="Logic\IContainer.cs" />
|
||||
<Compile Include="Pool\BulletContainer.cs" />
|
||||
<Compile Include="Pool\Collector.cs" />
|
||||
<Compile Include="Pool\PointContainer.cs" />
|
||||
<Compile Include="Pool\PointPool.cs" />
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
369e445224268321375e14dd582eb844e5d534bd
|
||||
76f5eaf647d5cdb61f503c89649a3cd3e872f683
|
||||
|
||||
Reference in New Issue
Block a user