unit

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Units map[string]*Unit
)

Functions

func TypeStrings

func TypeStrings() []string

TypeStrings returns a slice of all String values of the enum

Types

type Stats added in v1.1.0

type Stats struct {
	Health        float64 `json:"health"`
	Damage        float64 `json:"damage"`
	AttackSpeed   float64 `json:"attack_speed"`
	Shield        float64 `json:"shield"`
	Income        int     `json:"income"`
	Gold          int     `json:"gold"`
	MovementSpeed float64 `json:"movement_speed"`
}

type Type

type Type int
const (
	Ninja Type = iota
	Statue
	Hunter
	Slime
	Mole
	SkeletonDemon
	Butterfly
	BlendMaster
	Robot
	MonkeyBoxer
)

func TypeString

func TypeString(s string) (Type, error)

TypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func TypeValues

func TypeValues() []Type

TypeValues returns all values of the enum

func (Type) IsAType

func (i Type) IsAType() bool

IsAType returns "true" if the value is listed in the enum definition. "false" otherwise

func (Type) String

func (i Type) String() string

type Unit

type Unit struct {
	Type Type

	Stats

	Environment environment.Environment `json:"environment"`
	Abilities   []ability.Ability       `json:"abilities"`

	Keybind string

	Faceset image.Image
	Walk    image.Image
	Attack  image.Image
	Idle    image.Image
}

func (*Unit) AttackKey added in v1.2.0

func (u *Unit) AttackKey() string

func (*Unit) FacesetKey added in v1.0.3

func (u *Unit) FacesetKey() string

func (*Unit) HasAbility added in v1.2.0

func (u *Unit) HasAbility(a ability.Ability) bool

func (*Unit) IdleKey added in v1.2.0

func (u *Unit) IdleKey() string

func (*Unit) WalkKey added in v1.2.0

func (u *Unit) WalkKey() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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