45 lines
610 B
Go
45 lines
610 B
Go
package ecs_test
|
|
|
|
import (
|
|
"log"
|
|
"testing"
|
|
"time"
|
|
|
|
"joylink.club/ecs"
|
|
)
|
|
|
|
type Sys1 struct {
|
|
}
|
|
|
|
type Sys2 struct {
|
|
}
|
|
|
|
func (s *Sys1) Update(w ecs.World) {
|
|
log.Println("系统1运行")
|
|
}
|
|
|
|
func (s *Sys2) Update(w ecs.World) {
|
|
log.Println("系统2运行")
|
|
}
|
|
|
|
func BaseTest(t *testing.T) {
|
|
log.Println("Base Test")
|
|
w := ecs.NewWorld(500)
|
|
w.AddSystem(&Sys1{}, &Sys2{})
|
|
w.StartUp()
|
|
|
|
time.Sleep(3 * time.Second)
|
|
// w.SetSpeed(2)
|
|
|
|
// time.Sleep(3 * time.Second)
|
|
// w.Pause()
|
|
|
|
// time.Sleep(2 * time.Second)
|
|
// w.Resume()
|
|
|
|
// time.Sleep(2 * time.Second)
|
|
// w.Close()
|
|
|
|
// time.Sleep(3 * time.Second)
|
|
}
|