Files
tma-back/models/entity.go
Smile Rex 3c989c33f8
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m19s
new server
2026-01-17 16:38:45 +03:00

52 lines
821 B
Go

package models
type EntityType uint8
const (
EntityPlayer EntityType = 1
EntityNPC EntityType = 2
EntityBullet EntityType = 3
)
type Entity interface {
GetID() uint32
GetType() EntityType
GetPosition() (float32, float32, float32)
SetPosition(float32, float32, float32)
GetYaw() float32
SetYaw(float32)
}
type BaseEntity struct {
ID uint32
Type EntityType
X, Y, Z float32
Yaw float32
}
func (e *BaseEntity) GetID() uint32 {
return e.ID
}
func (e *BaseEntity) GetType() EntityType {
return e.Type
}
func (e *BaseEntity) GetPosition() (float32, float32, float32) {
return e.X, e.Y, e.Z
}
func (e *BaseEntity) SetPosition(x, y, z float32) {
e.X = x
e.Y = y
e.Z = z
}
func (e *BaseEntity) GetYaw() float32 {
return e.Yaw
}
func (e *BaseEntity) SetYaw(yaw float32) {
e.Yaw = yaw
}