mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-23 08:00:51 +01:00
Anoher update
This commit is contained in:
parent
cdffd4dff2
commit
d7d49e5974
@ -17,7 +17,6 @@ export class MovingObjectLogic extends RoomObjectLogicBase
|
|||||||
private _locationDelta: Vector3d;
|
private _locationDelta: Vector3d;
|
||||||
private _lastUpdateTime: number;
|
private _lastUpdateTime: number;
|
||||||
private _changeTime: number;
|
private _changeTime: number;
|
||||||
private _updateInterval: number;
|
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
@ -29,7 +28,6 @@ export class MovingObjectLogic extends RoomObjectLogicBase
|
|||||||
this._locationDelta = new Vector3d();
|
this._locationDelta = new Vector3d();
|
||||||
this._lastUpdateTime = 0;
|
this._lastUpdateTime = 0;
|
||||||
this._changeTime = 0;
|
this._changeTime = 0;
|
||||||
this._updateInterval = MovingObjectLogic.UPDATE_MOVING_INTERVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onDispose(): void
|
protected onDispose(): void
|
||||||
@ -74,14 +72,14 @@ export class MovingObjectLogic extends RoomObjectLogicBase
|
|||||||
|
|
||||||
let difference = (this.time - this._changeTime);
|
let difference = (this.time - this._changeTime);
|
||||||
|
|
||||||
if(difference === (this._updateInterval >> 1)) difference++;
|
if(difference === (MovingObjectLogic.UPDATE_MOVING_INTERVAL >> 1)) difference++;
|
||||||
|
|
||||||
if(difference > this._updateInterval) difference = this._updateInterval;
|
if(difference > MovingObjectLogic.UPDATE_MOVING_INTERVAL) difference = MovingObjectLogic.UPDATE_MOVING_INTERVAL;
|
||||||
|
|
||||||
if(this._locationDelta.length > 0)
|
if(this._locationDelta.length > 0)
|
||||||
{
|
{
|
||||||
vector.assign(this._locationDelta);
|
vector.assign(this._locationDelta);
|
||||||
vector.multiply((difference / this._updateInterval));
|
vector.multiply((difference / MovingObjectLogic.UPDATE_MOVING_INTERVAL));
|
||||||
vector.add(this._location);
|
vector.add(this._location);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -93,7 +91,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase
|
|||||||
|
|
||||||
this.object.setLocation(vector);
|
this.object.setLocation(vector);
|
||||||
|
|
||||||
if(difference === this._updateInterval)
|
if(difference === MovingObjectLogic.UPDATE_MOVING_INTERVAL)
|
||||||
{
|
{
|
||||||
this._locationDelta.x = 0;
|
this._locationDelta.x = 0;
|
||||||
this._locationDelta.y = 0;
|
this._locationDelta.y = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user