Daily update on 20221022
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.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Geometry
|
||||
{
|
||||
internal unsafe class Circle
|
||||
internal unsafe class Circle:Geometry
|
||||
{
|
||||
private Point _center;
|
||||
|
||||
@@ -31,8 +31,9 @@ namespace StgSharp_Geometry
|
||||
this._radius = radius;
|
||||
}
|
||||
|
||||
public void BindPoint(float angle,int number,SimpleContainer geoItemPool)
|
||||
public void BindPoint(float angle,int number,GeometryContainer geoItemPool)
|
||||
{
|
||||
|
||||
for (int i = 1; i <= number; i++)
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using StgSharp_Geometry;
|
||||
using StgSharp_Logic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Geometry
|
||||
{
|
||||
internal class Geometry:LinkedTarget
|
||||
{
|
||||
public new LinkedTarget Previous
|
||||
{
|
||||
get { return this.Previous; }
|
||||
set
|
||||
{
|
||||
if (value is Geometry)
|
||||
{
|
||||
this.Previous = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public new LinkedTarget Next
|
||||
{
|
||||
get { return this.Next; }
|
||||
set
|
||||
{
|
||||
if (value is Geometry)
|
||||
{
|
||||
this.Next = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Add()
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Geometry
|
||||
{
|
||||
internal class Line
|
||||
{
|
||||
private Point _beginPoint;
|
||||
|
||||
public Point BeginPoint
|
||||
{
|
||||
get { return _beginPoint; }
|
||||
set { _beginPoint = value; }
|
||||
}
|
||||
|
||||
private Point _endingPoint;
|
||||
|
||||
public Point EndingPoint
|
||||
{
|
||||
get { return _endingPoint; }
|
||||
set { _endingPoint = value; }
|
||||
}
|
||||
|
||||
public Line(Point begin,Point end)
|
||||
{
|
||||
_beginPoint= begin;
|
||||
_endingPoint= end;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,20 @@ namespace StgSharp_Geometry
|
||||
set { _y = value; }
|
||||
}
|
||||
|
||||
|
||||
public new LinkedTarget Next
|
||||
{
|
||||
get { return this.Next; }
|
||||
set
|
||||
{
|
||||
if (value is Point)
|
||||
{
|
||||
this.Next = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnRender()
|
||||
{ }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Geometry
|
||||
{
|
||||
internal class PointOnCircle : Point
|
||||
internal unsafe class PointOnCircle : Point
|
||||
{
|
||||
private Circle _bindedItem;
|
||||
|
||||
@@ -25,12 +25,15 @@ namespace StgSharp_Geometry
|
||||
}
|
||||
|
||||
private float[] _angularVelocity;
|
||||
private readonly uint beginTick;
|
||||
private readonly uint* nowtick;
|
||||
|
||||
public PointOnCircle(Circle c, float p, float angle, int counts)
|
||||
public PointOnCircle(Circle c, float p, float angle, uint counts,uint* gameTick)
|
||||
{
|
||||
_bindedItem = c;
|
||||
_angle = (angle + counts * (360.0f / counts))*(float)(2*Math.PI/360);
|
||||
|
||||
nowtick = gameTick;
|
||||
beginTick = *gameTick;
|
||||
}
|
||||
|
||||
public void AddRotation(float[] aFunc)
|
||||
@@ -44,18 +47,20 @@ namespace StgSharp_Geometry
|
||||
throw new Exception("Parameters are too much or too few!");
|
||||
}
|
||||
}
|
||||
public void onRender()
|
||||
public override void OnRender()
|
||||
{
|
||||
if (_angularVelocity!=null)
|
||||
{
|
||||
|
||||
uint a = *nowtick - beginTick;
|
||||
float deltaAngle = 0;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
|
||||
deltaAngle += _angularVelocity[i];
|
||||
deltaAngle *= a;
|
||||
}
|
||||
_angle+=deltaAngle;
|
||||
}
|
||||
|
||||
|
||||
this.X = (float)(_bindedItem.Center.X + _bindedItem.Radius * Math.Cos(_angle));
|
||||
this.Y = (float)(_bindedItem.Center.X + _bindedItem.Radius * Math.Sin(_angle));
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Geometry
|
||||
{
|
||||
internal class PointOnLine : Point
|
||||
{
|
||||
private Point _beginPoint;
|
||||
|
||||
public Point BeginPoint
|
||||
{
|
||||
get { return _beginPoint; }
|
||||
set { _beginPoint = value; }
|
||||
}
|
||||
|
||||
private Point _endPoint;
|
||||
|
||||
public Point EndPoint
|
||||
{
|
||||
get { return _endPoint; }
|
||||
set { _endPoint = value; }
|
||||
}
|
||||
|
||||
private float _angle;
|
||||
|
||||
public float Angle
|
||||
{
|
||||
get { return _angle; }
|
||||
set { _angle = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
private float rate;
|
||||
|
||||
public PointOnLine(Point beginPoint,Point endPoint,float rate,int number)
|
||||
{
|
||||
_beginPoint = beginPoint;
|
||||
_endPoint = endPoint;
|
||||
|
||||
_angle = (float)(Math.Atan2(endPoint.Y-beginPoint.Y,endPoint.X-beginPoint.Y));
|
||||
|
||||
rate = rate * number;
|
||||
this.Y = beginPoint.Y + rate * (endPoint.Y - beginPoint.Y);
|
||||
this.X = beginPoint.X + rate * (endPoint.X - beginPoint.X);
|
||||
}
|
||||
|
||||
public override void OnRender()
|
||||
{
|
||||
_angle = (float)(Math.Atan2(_endPoint.Y - _beginPoint.Y, _endPoint.X - _beginPoint.Y));
|
||||
|
||||
this.Y = _beginPoint.Y + rate * (_endPoint.Y - _beginPoint.Y);
|
||||
this.X = _beginPoint.X + rate * (_endPoint.X - _beginPoint.X);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Circle.cs" />
|
||||
<Compile Include="Geometry.cs" />
|
||||
<Compile Include="Line.cs" />
|
||||
<Compile Include="PointOnLine.cs" />
|
||||
<Compile Include="PointOnCircle.cs" />
|
||||
<Compile Include="Point.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Bullets.cs" />
|
||||
<Compile Include="debug.cs" />
|
||||
<Compile Include="EntityPool.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,21 +0,0 @@
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using StgSharp_Entity;
|
||||
using StgSharp_Logic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
static unsafe void Main()
|
||||
{
|
||||
Console.WriteLine(typeof(Bullet).Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
namespace StgSharp_Entity
|
||||
{
|
||||
|
||||
public class Bullet:LinkedTarget
|
||||
public unsafe class Bullet:LinkedTarget
|
||||
{
|
||||
|
||||
//子弹的缩放比例
|
||||
@@ -85,21 +85,21 @@ namespace StgSharp_Entity
|
||||
}
|
||||
}
|
||||
|
||||
private float _xVertical;
|
||||
private float* _x;
|
||||
|
||||
//xy坐标
|
||||
public float XVertical
|
||||
public float* X
|
||||
{
|
||||
get { return _xVertical; }
|
||||
set { _xVertical = value; }
|
||||
get { return _x; }
|
||||
set { _x = value; }
|
||||
}
|
||||
|
||||
private float _yVertical;
|
||||
private float* _y;
|
||||
|
||||
public float YVertical
|
||||
public float* Y
|
||||
{
|
||||
get { return _yVertical; }
|
||||
set { _yVertical = value; }
|
||||
get { return _y; }
|
||||
set { _y = value; }
|
||||
}
|
||||
|
||||
private uint _beginTick;
|
||||
@@ -110,6 +110,9 @@ namespace StgSharp_Entity
|
||||
set { _beginTick = value; }
|
||||
}
|
||||
|
||||
public Bullet()
|
||||
{
|
||||
}
|
||||
|
||||
//通过传入的时间刻计算位移并更新位置坐标
|
||||
public void move(uint tick)
|
||||
@@ -122,7 +125,7 @@ namespace StgSharp_Entity
|
||||
deltaX *= deltaTick;
|
||||
}
|
||||
deltaX += _xVelocity[10];
|
||||
_xVertical += deltaX;
|
||||
*_x += deltaX;
|
||||
float deltaY = 0;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
@@ -130,34 +133,32 @@ namespace StgSharp_Entity
|
||||
deltaY *= deltaTick;
|
||||
}
|
||||
deltaY += _yVelocity[10];
|
||||
_yVertical += deltaY;
|
||||
*_y += deltaY;
|
||||
}
|
||||
|
||||
public Bullet()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改自身路径,修改条件由外部逻辑判断触发
|
||||
/// </summary>
|
||||
public void ChangeVelocity(float[] newXSpeed,float[] newYSpeed)
|
||||
public void ChangeVelocity(float[] XSpeed,float[] YSpeed)
|
||||
{
|
||||
if (newXSpeed != null)
|
||||
if (XSpeed != null)
|
||||
{
|
||||
if (newXSpeed.Length == 10)
|
||||
if (XSpeed.Length == 10)
|
||||
{
|
||||
this._xVelocity = newXSpeed;
|
||||
this._xVelocity = XSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("The amount of parameters should be 10!");
|
||||
}
|
||||
}
|
||||
if (newYSpeed != null)
|
||||
if (YSpeed != null)
|
||||
{
|
||||
if (newYSpeed.Length == 10)
|
||||
if (YSpeed.Length == 10)
|
||||
{
|
||||
this._yVelocity = newYSpeed;
|
||||
this._yVelocity = YSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -50,11 +50,10 @@ namespace StgSharp_Logic
|
||||
|
||||
public void Add(LinkedTarget target)
|
||||
{
|
||||
if (true)
|
||||
if (true) //对target类型进行判断,应当只是实体
|
||||
{
|
||||
|
||||
}
|
||||
_container.Add(target);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAt(int id)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
using OpenTK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Logic
|
||||
{
|
||||
public class GeometryContainer
|
||||
{
|
||||
private LinkedList _container;
|
||||
|
||||
public LinkedList Container
|
||||
{
|
||||
get { return _container; }
|
||||
set { _container = value; }
|
||||
}
|
||||
|
||||
private float _leftBorder;
|
||||
|
||||
public float LeftBorder
|
||||
{
|
||||
get { return _leftBorder; }
|
||||
set { _leftBorder = value; }
|
||||
}
|
||||
|
||||
private float _rightBorder;
|
||||
|
||||
public float RightBorder
|
||||
{
|
||||
get { return _rightBorder; }
|
||||
set { _rightBorder = value; }
|
||||
}
|
||||
|
||||
private float _upBorder;
|
||||
|
||||
public float UpBorder
|
||||
{
|
||||
get { return _upBorder; }
|
||||
set { _upBorder = value; }
|
||||
}
|
||||
|
||||
private float _downBorder;
|
||||
|
||||
public float DownBorder
|
||||
{
|
||||
get { return _downBorder; }
|
||||
set { _downBorder = value; }
|
||||
}
|
||||
|
||||
|
||||
public GeometryContainer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Add(LinkedTarget t)
|
||||
{
|
||||
_container.Add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using OpenTK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Logic
|
||||
{
|
||||
public class SimpleContainer
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SimpleContainer.cs" />
|
||||
<Compile Include="GeometryContainer.cs" />
|
||||
<Compile Include="LinkedList.cs" />
|
||||
<Compile Include="LinkedTarget.cs" />
|
||||
<Compile Include="Counter.cs" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
db769c63e34adb286b6eefdc1550008efc594664
|
||||
7ca1e6081e494ab105ef5baa469f5f9fc4ab8d06
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user