示例#1
0
文件: source.go 项目: wbpmrck/survive
//创建一个时间源(当前时刻,每一帧发出的游戏时间间隔,时间流逝速度)
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
文件: pipe.go 项目: wbpmrck/survive
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),
	}
}