本文整理汇总了Golang中github.com/Cristofori/kmud/types.Room.HasExit方法的典型用法代码示例。如果您正苦于以下问题:Golang Room.HasExit方法的具体用法?Golang Room.HasExit怎么用?Golang Room.HasExit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Cristofori/kmud/types.Room
的用法示例。
在下文中一共展示了Room.HasExit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: addRoom
func (self *mapBuilder) addRoom(room types.Room, x int, y int, z int) {
x = x * 2
y = y * 2
addIfExists := func(dir types.Direction, x int, y int) {
if x < 0 || y < 0 {
return
}
if room.HasExit(dir) {
self.data[z][y][x].addExit(dir)
}
}
if self.userRoom.GetId() == room.GetId() {
self.data[z][y][x].char = '*'
self.data[z][y][x].color = types.ColorRed
} else {
self.data[z][y][x].color = types.ColorMagenta
if room.HasExit(types.DirectionUp) && room.HasExit(types.DirectionDown) {
self.data[z][y][x].char = '+'
} else if room.HasExit(types.DirectionUp) {
self.data[z][y][x].char = '^'
} else if room.HasExit(types.DirectionDown) {
self.data[z][y][x].char = 'v'
} else {
char := '#'
/*
count := len(model.CharactersIn(room.GetId()))
if count < 10 {
char = rune(strconv.Itoa(count)[0])
}
*/
self.data[z][y][x].char = char
self.data[z][y][x].color = types.ColorWhite
}
}
addIfExists(types.DirectionNorth, x, y-1)
addIfExists(types.DirectionNorthEast, x+1, y-1)
addIfExists(types.DirectionEast, x+1, y)
addIfExists(types.DirectionSouthEast, x+1, y+1)
addIfExists(types.DirectionSouth, x, y+1)
addIfExists(types.DirectionSouthWest, x-1, y+1)
addIfExists(types.DirectionWest, x-1, y)
addIfExists(types.DirectionNorthWest, x-1, y-1)
}