You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
🆙 Fix Sleep & Blinking eye's
This commit is contained in:
@@ -188,19 +188,30 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
}
|
||||
}
|
||||
|
||||
if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 1);
|
||||
const isSleeping = (model.getValue<number>(RoomObjectVariable.FIGURE_SLEEP) > 0);
|
||||
|
||||
this._blinkingStartTimestamp = time + this.randomBlinkStartTimestamp();
|
||||
this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp();
|
||||
}
|
||||
|
||||
if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp))
|
||||
if(isSleeping)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
|
||||
|
||||
this._blinkingEndTimestamp = 0;
|
||||
this._blinkingStartTimestamp = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 1);
|
||||
|
||||
this._blinkingStartTimestamp = time + this.randomBlinkStartTimestamp();
|
||||
this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp();
|
||||
}
|
||||
|
||||
if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
|
||||
|
||||
this._blinkingEndTimestamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp))
|
||||
@@ -305,6 +316,9 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
if(message instanceof ObjectAvatarSleepUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0);
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
|
||||
|
||||
this._blinkingEndTimestamp = 0;
|
||||
|
||||
if(message.isSleeping) this._blinkingStartTimestamp = -1;
|
||||
else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp());
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { AlphaTolerance, AvatarAction, AvatarGuideStatus, AvatarSetType, IAdvancedMap, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType, RoomObjectVariable } from '@nitrots/api';
|
||||
import { GetAssetManager } from '@nitrots/assets';
|
||||
import { AdvancedMap, GetRenderer } from '@nitrots/utils';
|
||||
import { Container, RenderTexture, Sprite, Texture } from 'pixi.js';
|
||||
import { RoomObjectSpriteVisualization } from '../RoomObjectSpriteVisualization';
|
||||
@@ -429,7 +428,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
|
||||
const assetName = ((((((this._avatarImage.getScale() + '_') + spriteData.member) + '_') + dd) + '_') + frameNumber);
|
||||
|
||||
const asset = GetAssetManager().getAsset(assetName);
|
||||
const asset = this._avatarImage.getAsset(assetName);
|
||||
|
||||
if(!asset) continue;
|
||||
|
||||
@@ -958,7 +957,15 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
|
||||
if(this._talk) this._avatarImage.appendAction(AvatarAction.TALK);
|
||||
|
||||
if(this._sleep || this._blink) this._avatarImage.appendAction(AvatarAction.SLEEP);
|
||||
if(this._sleep)
|
||||
{
|
||||
this._avatarImage.appendAction(AvatarAction.SLEEP);
|
||||
}
|
||||
else if(this._blink)
|
||||
{
|
||||
this._avatarImage.appendAction(AvatarAction.BLINK);
|
||||
this._avatarImage.appendAction(AvatarAction.SLEEP);
|
||||
}
|
||||
|
||||
if(this._expression > 0)
|
||||
{
|
||||
@@ -1189,7 +1196,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
{
|
||||
sprite.libraryAssetName = 'sh_std_sd_1_0_0';
|
||||
|
||||
this._shadow = GetAssetManager().getAsset(sprite.libraryAssetName);
|
||||
this._shadow = this._avatarImage.getAsset(sprite.libraryAssetName);
|
||||
|
||||
offsetX = -8;
|
||||
offsetY = ((this._canStandUp) ? 6 : -3);
|
||||
@@ -1198,7 +1205,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
{
|
||||
sprite.libraryAssetName = 'h_std_sd_1_0_0';
|
||||
|
||||
this._shadow = GetAssetManager().getAsset(sprite.libraryAssetName);
|
||||
this._shadow = this._avatarImage.getAsset(sprite.libraryAssetName);
|
||||
|
||||
offsetX = -17;
|
||||
offsetY = ((this._canStandUp) ? 10 : -7);
|
||||
|
||||
Reference in New Issue
Block a user