world

package
v0.0.0-...-b8d9494 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coords

type Coords struct {
	X int
	Z int
}

type ITile

type ITile interface {
	model.IDrawable

	SetName(string)
	Name() string

	BaseNode() model.INode

	SetWalkThrough(bool)
	WalkThrough() bool
	SetSeeThrough(bool)
	SeeThrough() bool
	SetFallThrough(bool)
	FallThrough() bool
	SetConnect(bool)
	Connect() bool
	SetCleanable(bool)
	Cleanable() bool

	SetY(v float32)
	Y() float32
}

func NewTile

func NewTile(name string, node model.INode) ITile

type Room

type Room struct {
	Floor     [][]func() ITile
	InterestX int
	InterestZ int
}

func (*Room) Apply

func (r *Room) Apply(w *World, x, z int, y float32) (min, max *Coords)

func (*Room) CanApply

func (r *Room) CanApply(w *World, x, z int) bool

func (*Room) CanConnect

func (r *Room) CanConnect(tileComparator func(ITile, ITile) bool, roomX, roomZ int, w *World, worldX, worldZ int) bool

func (*Room) Connect

func (r *Room) Connect(connectorTile func() ITile, roomX, roomZ int, w *World, worldX, worldZ int) (min, max *Coords)

func (*Room) FindConnect

func (r *Room) FindConnect() []*Coords

func (*Room) GetTile

func (r *Room) GetTile(x, z int) ITile

func (*Room) Height

func (r *Room) Height() int

func (*Room) ValidTiles

func (r *Room) ValidTiles() []*Coords

func (*Room) Width

func (r *Room) Width() int

type World

type World struct {
	// contains filtered or unexported fields
}

func Empty

func Empty(tileSize, gravity float32) *World

func New

func New(floor [][]ITile, tileSize float32, zeroX, zeroZ int, gravity float32) *World

func (*World) Center

func (w *World) Center(x, z int) (position *math32.Vector3)

func (*World) DefaultTile

func (w *World) DefaultTile() ITile

func (*World) DeltaXZForBorderCoverage

func (w *World) DeltaXZForBorderCoverage(radius float32) (deltaX, deltaZ []float32, deltaCount int)

func (*World) DeltaXZForTileCoverage

func (w *World) DeltaXZForTileCoverage(radius float32) (deltaX, deltaZ []float32, deltaCount int)

func (*World) EvaluateRay

func (w *World) EvaluateRay(source, destination *math32.Vector3, ok func(ITile) bool) (success bool, fragmentSuccess float32)

func (*World) EvaluateRayRadius

func (w *World) EvaluateRayRadius(source, destination *math32.Vector3, radius float32, ok func(ITile) bool) (success bool, fragmentSuccess float32)

func (*World) FindConnect

func (w *World) FindConnect(minCoords, maxCoords *Coords) []*Coords

func (*World) GetTile

func (w *World) GetTile(x, z int) ITile

func (*World) Gravity

func (w *World) Gravity() float32

func (*World) GrowX

func (w *World) GrowX(x int)

func (*World) GrowZ

func (w *World) GrowZ(z int)

func (*World) Height

func (w *World) Height() int

func (*World) IsFallingToVoid

func (w *World) IsFallingToVoid(position *math32.Vector3, radius float32) (falling bool, fallPoint *math32.Vector3)

func (*World) MaxCoords

func (w *World) MaxCoords() *Coords

func (*World) MinCoords

func (w *World) MinCoords() *Coords

func (*World) Node

func (w *World) Node() model.INode

func (*World) SetTile

func (w *World) SetTile(x, z int, t ITile)

func (*World) TileSize

func (w *World) TileSize() float32

func (*World) WhereStanding

func (w *World) WhereStanding(position *math32.Vector3) (tileX, tileZ int)

func (*World) Width

func (w *World) Width() int

Jump to

Keyboard shortcuts

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