pub struct Unit {
    pub unit_type: UnitType,
    pub position: (i32, i32),
    pub hp: (i32, i32),
    pub atk: i32,
    pub facing: Option<Direction>,
}
Expand description

The state of a unit: its position, current/max hp, and atk power.

Fields

unit_type: UnitTypeposition: (i32, i32)hp: (i32, i32)atk: i32facing: Option<Direction>

Implementations

Create a unit of type unit_type at position.

Create a unit of type Archer (7 HP, 3 ATK) at position.

Create a unit of type Captive (1 HP, 0 ATK) at position.

Create a unit of type Sludge (12 HP, 3 ATK) at position.

Create a unit of type ThickSludge (18 HP, 3 ATK) at position.

Create a unit of type Warrior (20 HP, 5 ATK) at position.

Create a unit of type Wizard (3 HP, 11 ATK) at position.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.