The Battle for Wesnoth  1.19.5+dev
Classes | Public Member Functions | Private Attributes | List of all members
unit_animator Class Reference

#include <animation.hpp>

Classes

struct  anim_elem
 

Public Member Functions

void add_animation (unit_const_ptr animated_unit, const unit_animation *animation, const map_location &src=map_location::null_location(), bool with_bars=false, const std::string &text="", const color_t text_color={0, 0, 0})
 
void add_animation (unit_const_ptr animated_unit, const std::string &event, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const int value=0, bool with_bars=false, const std::string &text="", const color_t text_color={0, 0, 0}, const strike_result::type hit_type=strike_result::type::invalid, const_attack_ptr attack=nullptr, const_attack_ptr second_attack=nullptr, int value2=0)
 
bool has_animation (unit_const_ptr animated_unit, const std::string &event, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const int value=0, const strike_result::type hit_type=strike_result::type::invalid, const_attack_ptr attack=nullptr, const_attack_ptr second_attack=nullptr, int value2=0) const
 has_animation : return an boolean value if animated unit present and have animation specified, used for verify prensence of [leading_anim] or [resistance_anim] for playability of [teaching_anim] More...
 
void replace_anim_if_invalid (unit_const_ptr animated_unit, const std::string &event, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const int value=0, bool with_bars=false, const std::string &text="", const color_t text_color={0, 0, 0}, const strike_result::type hit_type=strike_result::type::invalid, const_attack_ptr attack=nullptr, const_attack_ptr second_attack=nullptr, int value2=0)
 
void start_animations ()
 
void pause_animation ()
 
void restart_animation ()
 
void clear ()
 
void set_all_standing ()
 
bool would_end () const
 
std::chrono::milliseconds get_animation_time () const
 
std::chrono::milliseconds get_animation_time_potential () const
 
std::chrono::milliseconds get_end_time () const
 
void wait_for_end () const
 
void wait_until (const std::chrono::milliseconds &animation_time) const
 

Private Attributes

std::vector< anim_elemanimated_units_
 
std::chrono::milliseconds start_time_ = std::chrono::milliseconds::min()
 

Detailed Description

Definition at line 188 of file animation.hpp.

Member Function Documentation

◆ add_animation() [1/2]

void unit_animator::add_animation ( unit_const_ptr  animated_unit,
const std::string &  event,
const map_location src = map_location::null_location(),
const map_location dst = map_location::null_location(),
const int  value = 0,
bool  with_bars = false,
const std::string &  text = "",
const color_t  text_color = {0,0,0},
const strike_result::type  hit_type = strike_result::type::invalid,
const_attack_ptr  attack = nullptr,
const_attack_ptr  second_attack = nullptr,
int  value2 = 0 
)

Definition at line 1296 of file animation.cpp.

References dst, unit_animation::get_begin_time(), and src.

◆ add_animation() [2/2]

void unit_animator::add_animation ( unit_const_ptr  animated_unit,
const unit_animation animation,
const map_location src = map_location::null_location(),
bool  with_bars = false,
const std::string &  text = "",
const color_t  text_color = {0,0,0} 
)

◆ clear()

void unit_animator::clear ( )
inline

◆ get_animation_time()

std::chrono::milliseconds unit_animator::get_animation_time ( ) const

Definition at line 1452 of file animation.cpp.

Referenced by unit_display::unit_attack().

◆ get_animation_time_potential()

std::chrono::milliseconds unit_animator::get_animation_time_potential ( ) const

Definition at line 1460 of file animation.cpp.

Referenced by unit_display::unit_attack().

◆ get_end_time()

std::chrono::milliseconds unit_animator::get_end_time ( ) const

Definition at line 1468 of file animation.cpp.

Referenced by unit_display::unit_attack().

◆ has_animation()

bool unit_animator::has_animation ( unit_const_ptr  animated_unit,
const std::string &  event,
const map_location src = map_location::null_location(),
const map_location dst = map_location::null_location(),
const int  value = 0,
const strike_result::type  hit_type = strike_result::type::invalid,
const_attack_ptr  attack = nullptr,
const_attack_ptr  second_attack = nullptr,
int  value2 = 0 
) const

has_animation : return an boolean value if animated unit present and have animation specified, used for verify prensence of [leading_anim] or [resistance_anim] for playability of [teaching_anim]

Returns
True if the animated_unit is present and have animation.
Parameters
animated_unitthe unit who is checked.
eventthe animation who is checked([leading_anim] or [resistance_anim].
srcthe location of animated_unit.
dstlocation of unit student(attacker or defender).
valuevalue of damage.
hit_typetype of damage inflicted.
attackweapon used by student.
second_attackweapon used by opponent.
value2i don't understand myself.but this value is used in choose_animation.

Definition at line 1332 of file animation.cpp.

References dst, and src.

Referenced by unit_display::unit_attack().

◆ pause_animation()

void unit_animator::pause_animation ( )

Definition at line 1480 of file animation.cpp.

◆ replace_anim_if_invalid()

void unit_animator::replace_anim_if_invalid ( unit_const_ptr  animated_unit,
const std::string &  event,
const map_location src = map_location::null_location(),
const map_location dst = map_location::null_location(),
const int  value = 0,
bool  with_bars = false,
const std::string &  text = "",
const color_t  text_color = {0,0,0},
const strike_result::type  hit_type = strike_result::type::invalid,
const_attack_ptr  attack = nullptr,
const_attack_ptr  second_attack = nullptr,
int  value2 = 0 
)

Definition at line 1345 of file animation.cpp.

References dst, unit_animation::MATCH_FAIL, and src.

◆ restart_animation()

void unit_animator::restart_animation ( )

Definition at line 1489 of file animation.cpp.

◆ set_all_standing()

void unit_animator::set_all_standing ( )

◆ start_animations()

void unit_animator::start_animations ( )

◆ wait_for_end()

void unit_animator::wait_for_end ( ) const

◆ wait_until()

void unit_animator::wait_until ( const std::chrono::milliseconds &  animation_time) const

◆ would_end()

bool unit_animator::would_end ( ) const

Definition at line 1395 of file animation.cpp.

Referenced by unit_display::unit_attack().

Member Data Documentation

◆ animated_units_

std::vector<anim_elem> unit_animator::animated_units_
private

Definition at line 275 of file animation.hpp.

Referenced by clear().

◆ start_time_

std::chrono::milliseconds unit_animator::start_time_ = std::chrono::milliseconds::min()
private

Definition at line 276 of file animation.hpp.

Referenced by clear().


The documentation for this class was generated from the following files: