當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。