1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package gg
- /*func (e *engine) Resolve() {
- eng := (*Engine)(e)
- type resHold struct{
- Resolver Resolver
- input chan *Context
- }
- colliders := map[CollisionType] []Collider{}
- resolvers := []resHold{}
- for _, object := range e.Objects.store {
- if object.IsResolvable() {
- interests := object.GetCollisionInterest()
- for _, interest := range interests {
- _, ok := colliders[interest]
- if !ok {
- colliders[interest] = []Collider{}
- }
- }
- resolvers = append(resolvers, resHold{
- object,
- object.Input(),
- })
- }
- }
- for _, object := range e.Objects.store {
- if object.IsCollidable() {
- typ := object.CollisionType()
- _, ok := colliders[typ]
- if !ok {
- continue
- }
- colliders[typ] = append(colliders[typ], object)
- }
- }
- for _, resolver := range resolvers {
- interests := resolver.Resolver.GetCollisionInterest()
- cols := []Collision{}
- for _, interest := range interests {
- cols = append(cols, GetCollisions(resolver.Resolver, colliders[interest])...)
- }
- if len(cols) > 0 {
- c := &Context{
- typ: resolveContext,
- Collisions: cols,
- Engine: eng,
- }
- e.wg.Add(1)
- resolver.input <- c
- }
- }
- e.wg.Wait()
- }*/
|