entity

package
v0.0.0-...-309fd15 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: MIT Imports: 1 Imported by: 4

Documentation

Overview

Some witty description here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity interface {

	// Get the size of the entity.
	Radius() float64

	// Get the colour of this creature.
	Color() color.RGBA

	// Does all updating of an entity. Guarenteed to be thread-safe.
	Work()

	// Query the state of the entity.
	// Returns a boolean for if it is being torn down on this check.
	Check() bool

	// Attempt to consume the enitity.
	// Returns the amount consumed.
	Consume() float64
}

Entity defines the methods an entity in the environment must expose.

type TestEntity

type TestEntity struct {
	TeRadius float64
	TeDead   bool
	TeWork   int
}

Test entity, for testing!

func (*TestEntity) Check

func (te *TestEntity) Check() bool

Check the entity. It returns as expected.

func (*TestEntity) Color

func (te *TestEntity) Color() color.RGBA

Get the colour of this entity.

func (*TestEntity) Consume

func (te *TestEntity) Consume() float64

Test entities cannot be consumed.

func (*TestEntity) Radius

func (te *TestEntity) Radius() float64

Get the radius of the test entity.

func (*TestEntity) Work

func (te *TestEntity) Work()

Just increment the work counter.

Jump to

Keyboard shortcuts

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