new server
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m19s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m19s
This commit is contained in:
31
controllers/entities.go
Normal file
31
controllers/entities.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package controllers
|
||||
|
||||
import "server/models"
|
||||
|
||||
func (h *Hub) addEntity(id uint32, entity models.Entity) {
|
||||
h.Mu.Lock()
|
||||
defer h.Mu.Unlock()
|
||||
|
||||
h.Entities[id] = entity
|
||||
}
|
||||
|
||||
func (h *Hub) updateEntityPosition(x, y, z float32, entity_id uint32) {
|
||||
h.Mu.Lock()
|
||||
defer h.Mu.Unlock()
|
||||
|
||||
h.Entities[entity_id].SetPosition(x, y, z)
|
||||
}
|
||||
|
||||
func (h *Hub) updateEntityRotation(yaw float32, entity_id uint32) {
|
||||
h.Mu.Lock()
|
||||
defer h.Mu.Unlock()
|
||||
|
||||
h.Entities[entity_id].SetYaw(yaw)
|
||||
}
|
||||
|
||||
func (h *Hub) removeEntity(id uint32) {
|
||||
h.Mu.Lock()
|
||||
defer h.Mu.Unlock()
|
||||
|
||||
delete(h.Entities, id)
|
||||
}
|
||||
Reference in New Issue
Block a user