rts-sim-module/components/cstate/system_state.go
2023-08-23 18:06:09 +08:00

55 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cstate
import (
"time"
"github.com/yohamta/donburi/component"
"joylink.club/rtsssimulation/umi"
)
// 此文件中为与设备无关的仿真系统自身的状态定义
// 系统时钟,单例
type SystemTimer struct {
timer *time.Time
}
// 以指定时间构建
func NewSystemTimer(time *time.Time) *SystemTimer {
return &SystemTimer{
timer: time,
}
}
// 重置时间
func (me *SystemTimer) ResetTime(time time.Time) {
*me.timer = time
}
// 获取当前时间的副本
func (me *SystemTimer) Now() time.Time {
return *me.timer
}
// tick系统时钟,单位ms
func (me *SystemTimer) Tick(tick int) {
*me.timer = me.timer.Add(time.Duration(tick) * time.Millisecond)
}
/////////////////////////////////////////////////////////
// 实体标签
type EntityTag = component.IComponentType
type EntityTagHandler struct {
Tag EntityTag
}
/////////////////////////////////////////////////////////
// 模型仓库引用
// 用于world内使用查询模型
type ModelStorageRef struct {
ModelManager umi.IModelManager
}