mapbuilder

package
v1.45.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

参考: https://bfnightly.bracketproductions.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuilderChain

type BuilderChain struct {
	Starter   *InitialMapBuilder
	Builders  []MetaMapBuilder
	BuildData BuilderMap
}

func NewBuilderChain

func NewBuilderChain(width components.Row, height components.Col) *BuilderChain

func SimpleRoomBuilder

func SimpleRoomBuilder(width components.Row, height components.Col) *BuilderChain

func (*BuilderChain) Build

func (b *BuilderChain) Build()

func (*BuilderChain) StartWith

func (b *BuilderChain) StartWith(initialMapBuilder InitialMapBuilder)

func (*BuilderChain) With

func (b *BuilderChain) With(metaMapBuilder MetaMapBuilder)

type BuilderMap

type BuilderMap struct {
	Level     loader.Level
	Tiles     []Tile
	Rooms     []Rect
	Corridors [][]int
}

地図上のタイルを作る元になる概念の集合体

func (BuilderMap) AdjacentOrthoAnyFloor added in v1.43.0

func (bm BuilderMap) AdjacentOrthoAnyFloor(idx int) bool

直交する近傍4タイルに床があるか判定する

func (BuilderMap) DownTile added in v1.43.0

func (bm BuilderMap) DownTile(idx int) Tile

下にあるタイルを調べる

func (BuilderMap) LeftTile added in v1.43.0

func (bm BuilderMap) LeftTile(idx int) Tile

右にあるタイルを調べる

func (BuilderMap) RightTile added in v1.43.0

func (bm BuilderMap) RightTile(idx int) Tile

左にあるタイルを調べる

func (BuilderMap) UpTile added in v1.43.0

func (bm BuilderMap) UpTile(idx int) Tile

上にあるタイルを調べる

type InitialMapBuilder

type InitialMapBuilder interface {
	BuildInitial(*BuilderMap)
}

type LineCorridorBuilder

type LineCorridorBuilder struct{}

func (LineCorridorBuilder) BuildCorridors

func (b LineCorridorBuilder) BuildCorridors(buildData *BuilderMap)

func (LineCorridorBuilder) BuildMeta

func (b LineCorridorBuilder) BuildMeta(buildData *BuilderMap)

type MetaMapBuilder

type MetaMapBuilder interface {
	BuildMeta(*BuilderMap)
}

type Rect

type Rect struct {
	X1 int
	X2 int
	Y1 int
	Y2 int
}

func (*Rect) Center

func (r *Rect) Center() (int, int)

type RectRoomBuilder

type RectRoomBuilder struct{}

長方形の部屋を作成する

func (RectRoomBuilder) BuildInitial

func (b RectRoomBuilder) BuildInitial(buildData *BuilderMap)

func (RectRoomBuilder) BuildRooms

func (b RectRoomBuilder) BuildRooms(buildData *BuilderMap)

type RoomDraw

type RoomDraw struct{}

func (RoomDraw) BuildMeta

func (b RoomDraw) BuildMeta(buildData *BuilderMap)

type Tile

type Tile uint8

フィールドのタイル

const (
	TileEmpty Tile = iota
	TileFloor
	TileWall
	TileWarpNext
	TileWarpEscape
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL