UNPKG

the-world-engine

Version:

three.js based, unity like game engine for browser

52 lines (51 loc) 1.06 kB
export class b2Timer { constructor() { this.m_start = Date.now(); } Reset() { this.m_start = Date.now(); return this; } GetMilliseconds() { return Date.now() - this.m_start; } } export class b2Counter { constructor() { this.m_count = 0; this.m_min_count = 0; this.m_max_count = 0; } GetCount() { return this.m_count; } GetMinCount() { return this.m_min_count; } GetMaxCount() { return this.m_max_count; } ResetCount() { const t = this.m_count; this.m_count = 0; return t; } ResetMinCount() { this.m_min_count = 0; } ResetMaxCount() { this.m_max_count = 0; } Increment() { this.m_count++; if (this.m_max_count < this.m_count) { this.m_max_count = this.m_count; } } Decrement() { this.m_count--; if (this.m_min_count > this.m_count) { this.m_min_count = this.m_count; } } }