Documentation ¶
Index ¶
- Constants
- func BeginMoveObject(spc actor.ISpace, tid, objectId int64, x, y float32, complete utils.Action)
- func BindActorEventVisibleFac(typ actor.TActor, fac FActorEventVisibleFac)
- func CheckEventChunk(actor actor.IActor, event actor.IEvent) bool
- func EndMoveObject(spc actor.ISpace, tid, objectId int64, complete utils.Action)
- func GetAOISize(spc actor.ISpace) int32
- func GetBeginMoveEvent(obj actor.IActor) actor.IEvent
- func GetBoundsChunk(spc actor.ISpace, cx, cy int32, size int32) (chunkId string, tags []string)
- func GetChunkBoundsKey(chunkId string, size int32) string
- func GetChunkId(x, y int32) string
- func GetEndMoveEvent(obj actor.IActor) actor.IEvent
- func GetEventInvisible(obj actor.IActor) actor.IEvent
- func GetEventVisible(obj actor.IActor) actor.IEvent
- func GetMoveEvent(obj actor.IActor) actor.IEvent
- func GetObjChunk(obj actor.IActor) (cx, cy int32)
- func MoveObject(tid int64, obj actor.IActor, data interface{}, ms int64)
- func NewStage(option *Option) *stage
- func RecycleObject(spc actor.ISpace, tid, objectId int64, ...)
- func SetStage(spc actor.ISpace, stage IStage)
- func SpawnEvent(typ actor.TEvent, cx, cy, size int32) actor.IEvent
- func SpawnObject(spc actor.ISpace, tid, objectId int64, typ actor.TActor, data interface{}, ...)
- type ChunkBounds
- type ComMove
- type ComTransform
- type EventBase
- type EventBeginMove
- type EventEndMove
- type EventInvisible
- type EventMove
- type EventVisible
- type FActorEventVisibleFac
- type IStage
- type Option
Constants ¶
View Source
const ( Com_Transform actor.TComponent = iota Com_Move )
View Source
const ( Event_Visible actor.TEvent = iota Event_Invisible Event_BeginMove Event_Move Event_EndMove )
Variables ¶
This section is empty.
Functions ¶
func BeginMoveObject ¶
func BindActorEventVisibleFac ¶
func BindActorEventVisibleFac(typ actor.TActor, fac FActorEventVisibleFac)
绑定不同类型Actor的可见事件工厂
func CheckEventChunk ¶
检测事件的区块是否有效
func EndMoveObject ¶
func GetAOISize ¶
func GetBoundsChunk ¶
空间协程使用
func GetChunkBoundsKey ¶
func GetChunkId ¶
func MoveObject ¶
@Description: 对象移动心跳 @param tid 链路id @param obj 移动对象 @param data 数据,使用的*moveCache @param ms 时间间隔
func RecycleObject ¶
Types ¶
type ChunkBounds ¶
type ChunkBounds struct { MinX int32 MaxX int32 MinY int32 MaxY int32 OutMinX int32 OutMaxX int32 OutMinY int32 OutMaxY int32 Width int32 Length int32 }
所在空间的包围盒和超出的数值 超出数值用于大场景区块边界通知
type ComMove ¶
type ComMove struct { //每秒移速 Speed float32 //是否正在移动 Moving bool //移动的心跳id,用于取消心跳 TickId int64 //最后一次移动时间 LastMoveTime time.Time //移动方向归一后x值 ForwardX float32 //移动方向归一后y值 ForwardY float32 }
func (*ComMove) Type ¶
func (d *ComMove) Type() actor.TComponent
type ComTransform ¶
type ComTransform struct { //空间坐标x X float32 //空间坐标y Y float32 //区块x轴索引 CX int32 //区块y轴索引 CY int32 }
func (*ComTransform) Type ¶
func (d *ComTransform) Type() actor.TComponent
type EventBeginMove ¶
type EventBeginMove struct { EventBase ObjectId int64 X float32 Y float32 ForwardX float32 ForwardY float32 }
有可能
func (*EventBeginMove) Type ¶
func (e *EventBeginMove) Type() actor.TEvent
type EventEndMove ¶
func (*EventEndMove) Type ¶
func (e *EventEndMove) Type() actor.TEvent
type EventInvisible ¶
func (*EventInvisible) Type ¶
func (e *EventInvisible) Type() actor.TEvent
type EventMove ¶
type EventVisible ¶
type EventVisible struct { EventBase ObjectId int64 ObjectType actor.TActor //Transform X float32 Y float32 //Move Speed float32 Moving bool MoveX float32 MoveY float32 }
func (*EventVisible) Type ¶
func (e *EventVisible) Type() actor.TEvent
type IStage ¶
type IStage interface { // @Description: 舞台宽度,对应x // @return int32 Width() int32 // @Description: 舞台长度,对应y // @return int32 Length() int32 // @Description: 单块的尺寸 // @return int32 ChunkSize() int32 // @Description: 舞台宽的块数量 // @return int32 ChunkWidthCount() int32 // @Description: 舞台长的块数量 // @return int32 ChunkLengthCount() int32 // @Description: 默认视野范围,例如九宫是1,中心格子包围一圈 // @return int32 AOISize() int32 // @Description: 实际坐标转块位置,超出范围会纠正 // @param x // @param y // @return cx // @return cy // @return nx 纠正后的x坐标 // @return ny 纠正后的y坐标 PositionToChunk(x, y float32) (cx, cy int32, nx, ny float32) // @Description: // @param cx // @param cy // @param size // @return b GetChunkBounds(cx, cy int32, size int32) (b *ChunkBounds) // @Description: 获取包围块 // @param x 块x // @param y 块y // @param size 包围尺寸 // @return center 中心块id // @return bounds 周围块id GetBoundsChunks(x, y, size int32) (center string, bounds []string) // @Description: 获取开放地图的包围块,包含相邻舞台的块 // @param x 块x // @param y 块y // @param size 包围尺寸 // @return center 中心块id // @return leftTop 左上视野块 // @return centerTop 中上视野块 // @return rightTop 右上视野块 // @return leftMiddle 左中视野块 // @return centerMiddle 中视野块,(当前舞台的) // @return rightMiddle 右中视野块 // @return leftBottom 左下视野块 // @return centerBottom 中下视野块 // @return rightBottom 右下视野块 GetOpenBoundsChunks(x, y, size int32) (center string, leftTop, centerTop, rightTop, leftMiddle, centerMiddle, rightMiddle, leftBottom, centerBottom, rightBottom []string) // @Description: 从一块移动达到另一块的变化,返回退出块,进入块,不变块 // @param outX 退出块x // @param outY 退出块y // @param inX 进入块x // @param inY 进入块y // @param size 视野包围尺寸 // @return out 退出视野的所有块 // @return in 进入视野的所有块 // @return un 不变视野的所有块 GetChunkChangeCache(outX, outY, inX, inY, size int32) (out, in, un []string) }
@Description: 宫格舞台
Click to show internal directories.
Click to hide internal directories.