Remove removes an entity from the CollisionSystem.
(basic ecs.BasicEntity)
| 541 | |
| 542 | // Remove removes an entity from the CollisionSystem. |
| 543 | func (c *CollisionSystem) Remove(basic ecs.BasicEntity) { |
| 544 | delete := -1 |
| 545 | for index, e := range c.entities { |
| 546 | if e.BasicEntity.ID() == basic.ID() { |
| 547 | delete = index |
| 548 | break |
| 549 | } |
| 550 | } |
| 551 | if delete >= 0 { |
| 552 | c.entities = append(c.entities[:delete], c.entities[delete+1:]...) |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | // Update checks the entities for collision with eachother. Only Main entities are check for collision explicitly. |
| 557 | // If one of the entities are solid, the SpaceComponent is adjusted so that the other entities don't pass through it. |