ECS Framework API / Time
Class: Time
Defined in: Utils/Time.ts:5
时间管理工具类 提供游戏时间相关的功能,包括帧时间、总时间、时间缩放等
Constructors
Constructor
new Time():
Time
Returns
Time
Properties
deltaTime
static
deltaTime:number
=0
Defined in: Utils/Time.ts:9
上一帧到当前帧的时间间隔(秒)
unscaledDeltaTime
static
unscaledDeltaTime:number
=0
Defined in: Utils/Time.ts:14
未缩放的帧时间间隔(秒)
totalTime
static
totalTime:number
=0
Defined in: Utils/Time.ts:19
游戏开始以来的总时间(秒)
unscaledTotalTime
static
unscaledTotalTime:number
=0
Defined in: Utils/Time.ts:24
未缩放的总时间(秒)
timeScale
static
timeScale:number
=1
Defined in: Utils/Time.ts:29
时间缩放比例
frameCount
static
frameCount:number
=0
Defined in: Utils/Time.ts:34
当前帧数
Methods
update()
static
update(deltaTime
):void
Defined in: Utils/Time.ts:40
使用外部引擎提供的deltaTime更新时间信息
Parameters
deltaTime
number
外部引擎提供的帧时间间隔(秒)
Returns
void
sceneChanged()
static
sceneChanged():void
Defined in: Utils/Time.ts:56
场景改变时重置时间
Returns
void
checkEvery()
static
checkEvery(interval
,lastTime
):boolean
Defined in: Utils/Time.ts:70
检查指定的时间间隔是否已经过去
Parameters
interval
number
时间间隔(秒)
lastTime
number
上次检查的时间
Returns
boolean
是否已经过去指定时间