本文整理匯總了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())
}