本文整理汇总了Golang中github.com/runningwild/haunts/game.Game.DetermineLos方法的典型用法代码示例。如果您正苦于以下问题:Golang Game.DetermineLos方法的具体用法?Golang Game.DetermineLos怎么用?Golang Game.DetermineLos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/runningwild/haunts/game.Game
的用法示例。
在下文中一共展示了Game.DetermineLos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getTargetsAt
func (a *AoeAttack) getTargetsAt(g *game.Game, tx, ty int) []*game.Entity {
x := tx - (a.Diameter+1)/2
y := ty - (a.Diameter+1)/2
x2 := tx + a.Diameter/2
y2 := ty + a.Diameter/2
// If the diameter is even we need to run los from all four positions
// around the center of the aoe.
num_centers := 1
if a.Diameter%2 == 0 {
num_centers = 4
}
var targets []*game.Entity
for i := 0; i < num_centers; i++ {
// If num_centers is 4 then this will calculate the los for all four
// positions around the center
g.DetermineLos(tx+i%2, ty+i/2, a.Diameter, grid[i])
}
for _, ent := range g.Ents {
entx, enty := ent.Pos()
has_los := false
for i := 0; i < num_centers; i++ {
has_los = has_los || grid[i][entx][enty]
}
if has_los && entx >= x && entx < x2 && enty >= y && enty < y2 {
targets = append(targets, ent)
}
}
algorithm.Choose2(&targets, func(e *game.Entity) bool {
return e.Stats != nil
})
return targets
}