Пример #1
0
//创建一个时间源(当前时刻,每一帧发出的游戏时间间隔,时间流逝速度)
func NewSource(now dataStructure.Time, gameTimeUnitInMs time.Duration, timeRate float32) *Source {
	return &Source{
		Now:          now,
		GameTimeUnit: dataStructure.NewMilliSecondSpanWithGameSpan(gameTimeUnitInMs, timeRate),
		Receivers:    make([]Receiver, 0),
		State:        STATE_STOP,
	}
}
Пример #2
0
func NewPipe(gameTimeUnitInMS time.Duration, timeRate float32) *Pipe {
	return &Pipe{
		Rate:         timeRate,
		GameTimeUnit: dataStructure.NewMilliSecondSpanWithGameSpan(gameTimeUnitInMS, timeRate),
		TSRemain:     dataStructure.NewMilliSecondSpan(0, timeRate),
		Receivers:    make([]Receiver, 0),
	}
}