本文整理匯總了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)
}