コード例 #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),
	}
}