space

package
v0.0.0-...-72396ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISpace

type ISpace interface {
	entity.IEntity
	entity.IEntities

	//回收进Pool
	GCPool()
}

场景接口

type Space

type Space struct {
	SimpleEntity
	DelayCallHost
	//对象管理器
	*Entities

	MapID uint64 //地图ID
	//地图名字
	MapName string
	//是否需要加载动态阻挡
	IsObstacle bool
	//场景开始时间
	StartTime time.Time
	//当前时间
	CurrTime time.Time

	//时间轮
	Timer *timerwheel.Timer
	//寻路算法有关
	PathFindermgr pathfinder.IPathFinder
	// contains filtered or unexported fields
}

场景基础

func (*Space) Destroy

func (e *Space) Destroy()

销毁

func (*Space) GCPool

func (this *Space) GCPool()

回收进Pool;进去后state进入到暂停状态

func (*Space) GetID

func (this *Space) GetID() uint64

GetID 获取实体ID

func (*Space) Init

func (this *Space) Init() (err error)

初始化

func (*Space) Loop

func (e *Space) Loop()

循环调用

func (*Space) Looped

func (e *Space) Looped()

循环调用后

func (*Space) Looping

func (e *Space) Looping()

循环调用中

func (*Space) OnCreated

func (e *Space) OnCreated(etype string, eid, dbid uint64, realPtr IEntity, spacePtr IEntities, fly bool, param ...interface{})

在创建对象的时候调用 eid:实例的唯一ID etype:实例对象类型 dbid:实例持久化的唯一ID,如果没有持久化可以使用eid一样,也可以为0 realPtr:最外面的实例对象引用 spacePtr:最外面的实例所在空间的引用 fly:是否需要在redis中注册路由信息

func (*Space) OnPanic

func (e *Space) OnPanic(err error)

发生异常的时候

func (*Space) ReLoop

func (this *Space) ReLoop()

恢复到Loop状态;一般是从Pool拿出来的时候,会跑的逻辑

func (*Space) String

func (e *Space) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL