package main import ( "fmt" "time" "joylink.club/ecs" system "joylink.club/ecs/examples/rtss/sys" ) func main() { start := time.Now() for i := 0; i < 10; i++ { w := ecs.NewWorld(20) turnoutSys := system.NewTurnoutSys() w.AddSystem(turnoutSys) idcomp := ecs.IdComp entities := w.CreateMany(10, idcomp, system.TurnoutStateComp) for i, entry := range entities { idcomp.SetValue(entry, ecs.Id(fmt.Sprintf("%d", i))) var db bool var fb bool if i%2 == 0 { db = true } else { fb = true } system.TurnoutStateComp.SetValue(entry, system.TurnoutState{Db: db, Fb: fb}) } // tet := ecs.NewEventType[TestEvent](w) // tet.Subscribe() w.StartUp() go func() { for i := 0; i < 10; i++ { system.DingCao(w, "3") time.Sleep(200 * time.Millisecond) } }() } dt := time.Duration(time.Now().Nanosecond() - start.Nanosecond()) fmt.Println("执行耗时", dt) time.Sleep(5 * time.Second) }