当前位置: 首页>>代码示例>>Golang>>正文


Golang ICreature.GetVisibleCreatures方法代码示例

本文整理汇总了Golang中pulogic.ICreature.GetVisibleCreatures方法的典型用法代码示例。如果您正苦于以下问题:Golang ICreature.GetVisibleCreatures方法的具体用法?Golang ICreature.GetVisibleCreatures怎么用?Golang ICreature.GetVisibleCreatures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pulogic.ICreature的用法示例。


在下文中一共展示了ICreature.GetVisibleCreatures方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: internalCreatureSay

func (g *Game) internalCreatureSay(_creature pul.ICreature, _speakType int, _message string) bool {
	list := make(pul.CreatureList)
	if _speakType == pnet.SPEAK_YELL {
		position := _creature.GetPosition() // Get position of speaker

		g.mutexPlayerList.RLock()
		defer g.mutexPlayerList.RUnlock()
		for _, player := range g.Players {
			if player != nil {
				if position.IsInRange3p(player.GetPosition(), pos.NewPositionFrom(27, 21, 0)) {
					list[player.GetUID()] = player
				}
			}
		}
	} else {
		list = _creature.GetVisibleCreatures()
	}

	// Send chat message to all visible players
	for _, creature := range list {
		if creature.GetType() == CTYPE_PLAYER {
			player := creature.(*Player)
			// player.sendCreatureSay(_creature, _speakType, _message)
			player.sendToChannel(_creature, _speakType, _message, pnet.CHANNEL_LOCAL, 0)
		}
	}

	return true
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:29,代码来源:game.go

示例2: internalCreatureChangeVisible

func (g *Game) internalCreatureChangeVisible(_creature pul.ICreature, _visible bool) {
	list := _creature.GetVisibleCreatures()
	for _, tmpCreature := range list {
		if tmpCreature.GetType() == CTYPE_PLAYER {
			tmpCreature.(*Player).sendCreatureChangeVisibility(_creature, _visible)
		}
	}
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:8,代码来源:game.go

示例3: OnCreatureTurn

func (g *Game) OnCreatureTurn(_creature pul.ICreature, _direction int) {
	if _creature.GetDirection() != _direction {
		_creature.SetDirection(_direction)

		visibleCreatures := _creature.GetVisibleCreatures()
		for _, value := range visibleCreatures {
			value.OnCreatureTurn(_creature)
		}
	}
}
开发者ID:gasperko,项目名称:pokemon-universe,代码行数:10,代码来源:game.go


注:本文中的pulogic.ICreature.GetVisibleCreatures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。