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