Fix present logic

This commit is contained in:
Bill 2021-08-12 00:10:27 -04:00
parent 089db9cd2a
commit cfa1b6a6ab
2 changed files with 14 additions and 28 deletions

View File

@ -1,4 +1,5 @@
import { IAssetData } from '../../../../../core/asset/interfaces';
import { IParticleSystem } from '../../../../../core/asset/interfaces/particlesystem';
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
@ -32,7 +33,10 @@ export class FurniturePresentLogic extends FurnitureLogic
{
super.initialize(asset);
// particle system etc
if(asset.particleSystems && asset.particleSystems.length)
{
this.object.model.setValue<IParticleSystem[]>(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.particleSystems);
}
}
public processUpdateMessage(message: RoomObjectUpdateMessage): void

View File

@ -119,9 +119,9 @@ export class FurnitureParticleSystem
if(!this._emptySprite)
{
this._emptySprite = new NitroSprite(Texture.WHITE);
this._emptySprite = new NitroSprite(Texture.EMPTY);
this._emptySprite.tint = this._bgColor;
this._emptySprite.alpha = 0;
}
this._centerX = -(this._roomSprite.offsetX);
@ -183,25 +183,10 @@ export class FurnitureParticleSystem
if(!this._canvasTexture) this.updateCanvas();
if(this._blackOverlayAlphaTransform.alpha === 1)
{
this._emptySprite.filters = null;
Nitro.instance.renderer.render(this._emptySprite, {
renderTexture: this._canvasTexture,
clear: true
});
}
else
{
this._emptySprite.filters = [ this._blackOverlayAlphaTransform ];
Nitro.instance.renderer.render(this._emptySprite, {
renderTexture: this._canvasTexture,
transform: this._identityMatrix,
clear: true
});
}
for(const particle of this._currentEmitter.particles)
{
@ -209,16 +194,14 @@ export class FurnitureParticleSystem
const ty = ((this._centerY - offsetY) + ((((particle.y + ((particle.x + particle.z) / 2)) * k) / 10) * this._scaleMultiplier));
const asset = particle.getAsset();
if(asset)
if(asset && asset.texture)
{
const texture = asset.texture;
if(particle.fade && (particle.alphaMultiplier < 1))
{
this._translationMatrix.identity();
this._translationMatrix.translate((tx + asset.offsetX), (ty + asset.offsetY));
const sprite = new NitroSprite(texture);
const sprite = new NitroSprite(asset.texture);
this._particleColorTransform.alpha = particle.alphaMultiplier;
@ -233,8 +216,7 @@ export class FurnitureParticleSystem
else
{
const point = new NitroPoint((tx + asset.offsetX), (ty + asset.offsetY));
const sprite = new NitroSprite(texture);
const sprite = new NitroSprite(asset.texture);
sprite.x = point.x;
sprite.y = point.y;