shotmanager = new Shotmanager(shottexture, graphics.GraphicsDevice.Viewport.Bounds, ref spaceship, enemyship);
我将宇宙飞船的参数作为一个对象传递给了“射击管理员”类,但问题是太空船的参数是固定的并且没有变化,即使当我改变例如船的“位置”时!
这是shotmanager的构造函数:
public Shotmanager(Texture2D shottexture, Rectangle Movementbounds, ref shipclass spaceship, EnemyManager enemyship)
{
// TODO: Complete member initialization
this.shottexture = shottexture;
this.Movementbounds = Movementbounds;
this.spaceship = spaceship;
this.enemyship = enemyship;
}
这是我使用“宇宙飞船”对象的地方
{
Fireshot( spaceship.position, spaceshipshotvelocity);
}
我一直在改变位置,但显然对象不是通过参考发送的,换句话说就是发送宇宙飞船的初始值。
我是初学者程序员,请不要驱逐我。