예제 #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),
	}
}