daily update on 20230301 by nitload youmu, file struct cahnged and more vec func added

This commit is contained in:
Nitload
2023-03-02 01:30:46 +08:00
parent d09105c9c1
commit bb71567e51
594 changed files with 368 additions and 2601 deletions
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp_Geometry
{
internal unsafe class PointOnCircle : Point
{
private Circle _bindedItem;
public Circle geometryItem
{
get { return _bindedItem; }
set { _bindedItem = value; }
}
private float _angle;
public float Angle
{
get { return _angle; }
set { _angle = value; }
}
private float[] _angularVelocity;
private readonly uint beginTick;
private readonly uint* nowtick;
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)
{
if (aFunc.Length==10)
{
_angularVelocity=aFunc;
}
else
{
throw new Exception("Parameters are too much or too few!");
}
}
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));
}
}
}