我正在制作一个使用粒子效果进行爆炸的libGDX游戏.这在新手机上运行得相当不错,但在老款手机上(在HTC Desire上测试),当屏幕上有多个爆炸时fps显着滞后.
我目前正在考虑两种选择:
每个效果都有很多粒子,所以减少这个数量可能是一个选择,但我宁愿不是因为一致性和美学原因.
使用通过运行粒子效果生成的动画并保存每个帧.这看起来不错,而且会保持一致.图像大小可能存在问题.我也看不出如何使用libGDX粒子实现来完成这项工作.
有任何想法吗?
编辑: 代码的一些片段:在Assets类中加载效果后:
particleFire.load(Gdx.files.internal("explosion.p"),Gdx.files.internal(""));
Run Code Online (Sandbox Code Playgroud)
我在粒子对象的构造函数中加载粒子效果.我正在主渲染循环中创建这个对象,我知道它是优化的候选者.
explosion = new ParticleEffect(Assets.particleFire);
Run Code Online (Sandbox Code Playgroud)
在渲染线程中,调用此方法来绘制效果.
private void drawBlasts(float delta){
for(Missile projectile : world.missiles){
if (projectile.missileState == State.EXPLODING){
if(projectile.stateTime==0.0f) {
projectile.explosion.start();
continue;
}
projectile.explosion.setPosition(projectile.position.x, projectile.position.y);
projectile.explosion.draw(spriteBatcher, delta);
}
}
}
Run Code Online (Sandbox Code Playgroud)
爆炸片.p
- Delay -
active: false
- Duration -
lowMin: 1000.0
lowMax: 1000.0
- Count -
min: 0
max: 100
- Emission -
lowMin: 0.0
lowMax: 0.0
highMin: 250.0
highMax: 250.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0 …Run Code Online (Sandbox Code Playgroud) 我有问题将变量提供给New-MsolUser cmdlet.我收到以下错误.
New-MsolUser : A positional parameter cannot be found that accepts argument 'â?UserPrincipalName ausertest@test.ie â?UsageLocation'.
At C:\users\test\Documents\test.ps1:148 char:1
+ New-MsolUser -DisplayName $TargetFullname â?"UserPrincipalName $TargetEmail â?" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-MsolUser], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Online.Administration.Automation.NewUser
Run Code Online (Sandbox Code Playgroud)
我使用的代码是:
$Source = "AnotherADUser"
$TargetFname = "New"
$TargetLname = "User"
$Target = "ausertest"
$TargetFullname = [string]::Concat($TargetFname ," ", $TargetLname)
$SourceEmail = (Get-ADUser $source -Property EmailAddress).EmailAddress
$SourceDomain = $SourceEmail.split("@")[1]
$TargetEmail = ([string]::Concat($Target , "@" , $SourceDomain))
New-MsolUser -DisplayName $TargetFullname –UserPrincipalName $TargetEmail …Run Code Online (Sandbox Code Playgroud)