本文整理汇总了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
}
示例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)
}
}
}
示例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)
}
}
}