All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m19s
52 lines
821 B
Go
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
|
|
}
|