Beispiel #1
0
func (ml *mobList) registerMob(m *gameObjects.Mob) int64 {
	id := utils.GenerateId()
	ml.mobs[id] = m
	m.SetID(id)
	GetInstance().field.LinkToCells(m)
	return id
}
Beispiel #2
0
func (ml *mobList) takeAwayMob(m *gameObjects.Mob) {
	for _, item := range m.GetItems() {
		instance := GetInstance()
		m.DropItem(item, item.GetAmount())
		instance.field.LinkToCells(item)
		instance.items.addItem(item)
	}
	time.Sleep(consts.LIVING_AFTER_DEAD_DURATION)
	delete(ml.mobs, m.GetID())
	GetInstance().field.UnlinkFromCells(m)
}