Enum UnitType

Source
pub enum UnitType {
    Base(Box<BaseUnitType>),
    Tree(Box<TreeUnitType>),
    Animated(Box<AnimatedUnitType>),
    Doppleganger(Box<DopplegangerUnitType>),
    Moving(Box<MovingUnitType>),
    Action(Box<ActionUnitType>),
    BaseCombat(Box<BaseCombatUnitType>),
    Missile(Box<MissileUnitType>),
    Combat(Box<CombatUnitType>),
    Building(Box<BuildingUnitType>),
}

Variants§

§

Base(Box<BaseUnitType>)

The base unit type, for units that do not do anything.

§

Tree(Box<TreeUnitType>)

The tree unit type.

§

Animated(Box<AnimatedUnitType>)

Unit type that supports animated sprites.

§

Doppleganger(Box<DopplegangerUnitType>)

Unit type for the “fake” units you see in the fog of war, after the actual unit has been destroyed.

§

Moving(Box<MovingUnitType>)

Unit type that supports movement.

§

Action(Box<ActionUnitType>)

Unit type that supports being tasked by a player.

§

BaseCombat(Box<BaseCombatUnitType>)

Unit type that supports combat.

§

Missile(Box<MissileUnitType>)

Unit type for projectiles/missiles/arrows.

§

Combat(Box<CombatUnitType>)

Unit type that supports combat (with additional Age of Empires specific data).

§

Building(Box<BuildingUnitType>)

Unit type for buildings.

Implementations§

Source§

impl UnitType

Source

pub fn read_from(input: impl Read, version: f32) -> Result<Self>

Read a unit type from an input stream.

Source

pub fn write_to(&self, output: impl Write, version: f32) -> Result<()>

Write this unit type to an output stream.

Source

pub fn base(&self) -> &BaseUnitType

Get the base unit type properties for this unit.

Source

pub fn animated(&self) -> Option<&AnimatedUnitType>

Get the animated unit type properties for this unit.

Source

pub fn moving(&self) -> Option<&MovingUnitType>

Get the moving unit type properties for this unit.

Source

pub fn action(&self) -> Option<&ActionUnitType>

Get the action unit type properties for this unit.

Trait Implementations§

Source§

impl Clone for UnitType

Source§

fn clone(&self) -> UnitType

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UnitType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ActionUnitType> for UnitType

Source§

fn from(v: ActionUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<AnimatedUnitType> for UnitType

Source§

fn from(v: AnimatedUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<BaseCombatUnitType> for UnitType

Source§

fn from(v: BaseCombatUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<BaseUnitType> for UnitType

Source§

fn from(v: BaseUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<BuildingUnitType> for UnitType

Source§

fn from(v: BuildingUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<CombatUnitType> for UnitType

Source§

fn from(v: CombatUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<DopplegangerUnitType> for UnitType

Source§

fn from(v: DopplegangerUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<MissileUnitType> for UnitType

Source§

fn from(v: MissileUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<MovingUnitType> for UnitType

Source§

fn from(v: MovingUnitType) -> Self

Converts to this type from the input type.
Source§

impl From<TreeUnitType> for UnitType

Source§

fn from(v: TreeUnitType) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.