本文整理汇总了Golang中github.com/runningwild/haunts/game.Game.HoveredEnt方法的典型用法代码示例。如果您正苦于以下问题:Golang Game.HoveredEnt方法的具体用法?Golang Game.HoveredEnt怎么用?Golang Game.HoveredEnt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/runningwild/haunts/game.Game
的用法示例。
在下文中一共展示了Game.HoveredEnt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: HandleInput
func (a *Interact) HandleInput(group gui.EventGroup, g *game.Game) (bool, game.ActionExec) {
if found, event := group.FindEvent(gin.MouseLButton); found && event.Type == gin.Press {
bx, by := g.GetViewer().WindowToBoard(gin.In().GetCursor("Mouse").Point())
room_num := a.ent.CurrentRoom()
room := g.House.Floors[0].Rooms[room_num]
for door_num, door := range room.Doors {
rect := makeRectForDoor(room, door)
if rect.Contains(float64(bx), float64(by)) {
var exec interactExec
exec.Toggle_door = true
exec.SetBasicData(a.ent, a)
exec.Room = room_num
exec.Door = door_num
return true, &exec
}
}
}
target := g.HoveredEnt()
if target == nil {
return false, nil
}
if found, event := group.FindEvent(gin.MouseLButton); found && event.Type == gin.Press {
for i := range a.targets {
if a.targets[i] == target && distBetweenEnts(a.ent, target) <= a.Range {
var exec interactExec
exec.SetBasicData(a.ent, a)
exec.Target = target.Id
return true, &exec
}
}
return true, nil
}
return false, nil
}