jl-ecs/ecs_test.go

45 lines
610 B
Go
Raw Normal View History

2023-08-04 11:02:08 +08:00
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)
}