本文整理汇总了Golang中pulogic.ICreature.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:Golang ICreature.GetPosition方法的具体用法?Golang ICreature.GetPosition怎么用?Golang ICreature.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulogic.ICreature
的用法示例。
在下文中一共展示了ICreature.GetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CanSeeCreature
// CanSeeCreature checks if 2 creatures are near each others viewport
func CanSeeCreature(_self pul.ICreature, _other pul.ICreature) bool {
return CanSeePosition(_self.GetPosition(), _other.GetPosition())
}