Beispiel #1
0
func (a *Interact) Prep(ent *game.Entity, g *game.Game) bool {
	if a.Preppable(ent, g) {
		a.ent = ent
		room := g.House.Floors[0].Rooms[ent.CurrentRoom()]
		for _, door := range a.doors {
			_, other_door := g.House.Floors[0].FindMatchingDoor(room, door)
			if other_door != nil {
				door.HighlightThreshold(true)
				other_door.HighlightThreshold(true)
			}
		}
		return true
	}
	return false
}
Beispiel #2
0
func (a *Interact) findDoors(ent *game.Entity, g *game.Game) []*house.Door {
	room_num := ent.CurrentRoom()
	room := g.House.Floors[0].Rooms[room_num]
	x, y := ent.Pos()
	dx, dy := ent.Dims()
	ent_rect := makeIntFrect(x, y, x+dx, y+dy)
	var valid []*house.Door
	for _, door := range room.Doors {
		if door.AlwaysOpen() {
			continue
		}
		if ent_rect.Overlaps(makeRectForDoor(room, door)) {
			valid = append(valid, door)
		}
	}
	return valid
}