“公共矢量 SpeedVector”的“SpeedVector”出现“可访问性不一致”错误。
struct Vector
{
public float x;
public float y;
public Vector(float x, float y)
{
this.x = x;
this.y = y;
}
public static Vector operator +(Vector v1, Vector v2)
{
return new Vector(v1.x + v2.x, v1.y + v2.y);
}
}
public class GameObject : Control
{
public float mass;
private Vector speedVector = new Vector(0, 0);
public Vector SpeedVector
{
set
{
if (mass != 0)
{
speedVector = value;
}
}
get => speedVector;
}
public void ElliminateCollision(GameObject obj1, GameObject obj2)
{
}
}
1 个回答