拿这段代码:
\s+
function createGUIHud():Void
{
this.screen.gameHud = new NormalGameHud(10, 0, this.screen.getTextureAtlas());
this.screen.gameHud.x = FlxG.width - (this.screen.gameHud.width + GameSize.getPositionByPlatform(10));
this.screen.gameHud.y = GameSize.getPositionByPlatform(10);
}
// NormalGameHud.hx
public function new(lives:Int = 10, corn:Int = 0, textureAtlas:SparrowData)
{
super(0, 0, 30);
this.lives = lives;
this.cornCount = corn;
this.textureAtlas = textureAtlas;
this.createScoreboard();
this.createLivesCount();
this.createCornCounter();
}
是通过引用传递还是被复制?
我知道PHP通过引用传递对象,除非另有说明(前缀为textureAtlas
),否则会复制Arrays之类的东西。 Haxe同样适用吗?