99 lines
2.7 KiB
C#
99 lines
2.7 KiB
C#
using StgSharp.Entity;
|
|
using StgSharp.Geometry;
|
|
using StgSharp.Logic;
|
|
using StgSharp.Pool;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http.Headers;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StgSharp.Control
|
|
{
|
|
static public class Create
|
|
{
|
|
|
|
|
|
private static LinkedObject cache;
|
|
|
|
public static void Geometry(IPoint center, float radius, float angle, int num)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建一个子弹并将其绑定在一个指定的点上
|
|
/// </summary>
|
|
/// <param name="point"></param>
|
|
public static void Bullet(IPoint point)
|
|
{
|
|
BulletPool.mainContainer.Add(new Bullet(point));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建一组子弹,并将其绑定在点池的一组点上
|
|
/// 顺序是从最后创建的点向前计数
|
|
/// </summary>
|
|
/// <param name="begin">起始序号</param>
|
|
/// <param name="end">终点序号</param>
|
|
public static void Bullet(int begin, int end)
|
|
{
|
|
cache = PointPool.mainCotainer.Ending;
|
|
for (int i = 1; i < begin; i++)
|
|
{
|
|
cache--;
|
|
}
|
|
for (int i = begin; i < end; i++)
|
|
{
|
|
cache--;
|
|
BulletPool.mainContainer.Add(new Bullet(cache as IPoint));
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 在新创建的一个或一组圆的其中一个上创建一组子弹
|
|
/// </summary>
|
|
/// <param name="order"></param>
|
|
/// <param name="count"></param>
|
|
/// <param name="angle"></param>
|
|
public static void Bullet(int order,uint count,float angle)
|
|
{
|
|
cache=PointPool.mainCotainer.Ending;
|
|
for (int i = 1; i < count; i++)
|
|
{
|
|
cache--;
|
|
}
|
|
for (uint i = 0; i < count; i++)
|
|
{
|
|
PointOnCircle p = new PointOnCircle(cache as Circle, angle, i);
|
|
PointPool.mainCotainer.Add(p);
|
|
BulletPool.mainContainer.Add(new Bullet(p));
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 创建一个简单点,并设置其
|
|
/// </summary>
|
|
/// <param name="beginX"></param>
|
|
/// <param name="beginY"></param>
|
|
/// <param name="angle"></param>
|
|
/// <param name="x"></param>
|
|
/// <param name="y"></param>
|
|
public static void Point(float beginX,float beginY,float angle,float[] x, float[] y)
|
|
{
|
|
PointCommon p = new PointCommon(beginX, beginY, angle,Pool.tickCounter);
|
|
p.XVelocity = x;
|
|
p.YVelocity = y;
|
|
PointPool.mainCotainer.Add(p);
|
|
}
|
|
|
|
}
|
|
}
|