73 lines
1.6 KiB
C#
73 lines
1.6 KiB
C#
using StgSharp.Entity;
|
|
using StgSharp.Logic;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StgSharp.Geometry
|
|
{
|
|
public class PointOnCircle :LinkedObject, IPoint
|
|
{
|
|
private Circle _bindedItem;
|
|
|
|
public Circle geometryItem
|
|
{
|
|
get { return _bindedItem; }
|
|
set { _bindedItem = value; }
|
|
}
|
|
|
|
protected float _x;
|
|
|
|
public float X
|
|
{
|
|
get { return _x; }
|
|
set { _x = value; }
|
|
}
|
|
|
|
protected float _y;
|
|
|
|
public float Y
|
|
{
|
|
get { return _y; }
|
|
set { _y = value; }
|
|
}
|
|
|
|
private float _angle0;
|
|
private float _angle;
|
|
|
|
public float Angle
|
|
{
|
|
get { return _angle; }
|
|
set { _angle = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="c">点所在的圆</param>
|
|
/// <param name="angle">点的初项</param>
|
|
/// <param name="counts">阵列次数</param>
|
|
/// <param name="gameTick">游戏刻计数器</param>
|
|
public PointOnCircle(Circle c, float angle, uint counts)
|
|
{
|
|
_bindedItem = c;
|
|
_angle0 = (angle + counts * (360.0f / counts)) * (float)(2 * Math.PI / 360);
|
|
}
|
|
|
|
|
|
public void OnRender()
|
|
{
|
|
_angle = _angle0 + _bindedItem.Angle;
|
|
this._x = (float)(_bindedItem.Center.X + _bindedItem.Radius * Math.Cos(_angle));
|
|
this._y = (float)(_bindedItem.Center.X + _bindedItem.Radius * Math.Sin(_angle));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|