Skip to main content

EgoHandoff

Struct EgoHandoff 

Source
pub struct EgoHandoff { /* private fields */ }
Expand description

Der Übergabe-Automat. attach/release starten eine Blende, update(dt) schiebt sie, camera() liefert den Kamerapunkt, input_owner() sagt, wohin Eingaben gehören.

Die Einheitenposition wird von außen nachgeführt (set_unit_position) — hier lebt nur die Kamera-Logik, nicht die Spiellogik.

Implementations§

Source§

impl EgoHandoff

Source

pub fn new(cfg: EgoConfig, start: Vec2) -> Self

Source

pub fn config(&self) -> &EgoConfig

Source

pub fn mode(&self) -> ControlMode

Source

pub fn is_transitioning(&self) -> bool

Läuft gerade eine Überblendung?

Source

pub fn heading(&self) -> ControlMode

Zielmodus der laufenden (oder letzten) Blende — der Renderer mixt damit Kamerahöhe und Übersicht-Deckkraft.

Source

pub fn ego_blend(&self) -> f32

Überblendungsanteil 0..=1 Richtung Ego (1 = Ego fest, 0 = frei).

Source

pub fn progress(&self) -> f64

Fortschritt der laufenden Blende (0..=1); 1 wenn ruhig.

Source

pub fn camera(&self) -> Vec2

Kamerapunkt dieses Frames.

Source

pub fn input_owner(&self) -> InputOwner

Wohin gehören die Eingaben dieses Frames? Während der Blende bleibt alles bei der Kamera — die Einheit bekommt erst nach Attached.

Source

pub fn move_anchor(&mut self, delta: Vec2)

Strategiekamera bewegen (nur wirksam, wenn die Kamera frei ist; während einer Blende wird der Anker für danach gesetzt).

Source

pub fn anchor(&self) -> Vec2

Source

pub fn move_unit(&mut self, delta: Vec2)

Ego-Einheit bewegen — aufrufen, wenn input_owner InputOwner::Unit meldet.

Source

pub fn set_unit_position(&mut self, pos: Vec2)

Einheitenposition von außen nachführen (Physik/Spiellogik). Läuft keine Blende zur Einheit, folgt die Kamera sofort.

Source

pub fn unit_position(&self) -> Vec2

Source

pub fn attach(&mut self) -> bool

Übergabe zur Einheit: Kamera gleitet von ihrer aktuellen Position an die Einheitenposition. Bei duration = 0 sofortiger Wechsel. true liefert, wenn eine Blende gestartet (oder gewechselt) wurde.

Source

pub fn release(&mut self) -> bool

Rückgabe an die Strategie: Anker wird die aktuelle Kameraposition (kein Sprung des Strategieblicks), Kamera gleitet hin — bei attach ist Ziel die Einheit, hier der Anker.

Source

pub fn update(&mut self, dt: f64) -> Option<HandoffEvent>

Blende weitertreiben; liefert das Ereignis beim Abschließen.

Trait Implementations§

Source§

impl Clone for EgoHandoff

Source§

fn clone(&self) -> EgoHandoff

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for EgoHandoff

Source§

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

Formats the value using the given formatter. Read more

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.