Daily update on 20221022
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user