TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DistractMovementGenerator Class Reference

#include <IdleMovementGenerator.h>

Public Member Functions

 DistractMovementGenerator (uint32 timer)
 
void Initialize (Unit *) override
 
void Finalize (Unit *) override
 
void Reset (Unit *owner) override
 
bool Update (Unit *, uint32) override
 
MovementGeneratorType GetMovementGeneratorType () const override
 
- Public Member Functions inherited from MovementGenerator
virtual ~MovementGenerator ()
 
virtual void unitSpeedChanged ()
 
virtual bool GetResetPosition (Unit *, float &, float &, float &)
 

Private Attributes

uint32 m_timer
 

Constructor & Destructor Documentation

DistractMovementGenerator::DistractMovementGenerator ( uint32  timer)
inlineexplicit
56 : m_timer(timer) { }
uint32 m_timer
Definition: IdleMovementGenerator.h:65

Member Function Documentation

void DistractMovementGenerator::Finalize ( Unit owner)
overridevirtual

Implements MovementGenerator.

Reimplemented in AssistanceDistractMovementGenerator.

85 {
87 
88  // If this is a creature, then return orientation to original position (for idle movement creatures)
89  if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature())
90  {
91  float angle = owner->ToCreature()->GetHomePosition().GetOrientation();
92  owner->SetFacingTo(angle);
93  }
94 }
Definition: Unit.h:562
Definition: ObjectGuid.h:32
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
TypeID GetTypeId() const
Definition: Object.h:113
void SetFacingTo(float ori)
Definition: Unit.cpp:15777
Creature * ToCreature()
Definition: Object.h:194
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:672

+ Here is the call graph for this function:

MovementGeneratorType DistractMovementGenerator::GetMovementGeneratorType ( ) const
inlineoverridevirtual

Implements MovementGenerator.

Reimplemented in AssistanceDistractMovementGenerator.

62 { return DISTRACT_MOTION_TYPE; }
Definition: MotionMaster.h:48
void DistractMovementGenerator::Initialize ( Unit owner)
overridevirtual

Implements MovementGenerator.

76 {
77  // Distracted creatures stand up if not standing
78  if (!owner->IsStandState())
80 
82 }
Definition: Unit.h:207
Definition: Unit.h:562
void AddUnitState(uint32 f)
Definition: Unit.h:1394
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:12772
bool IsStandState() const
Definition: Unit.cpp:12766

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DistractMovementGenerator::Reset ( Unit owner)
inlineoverridevirtual

Implements MovementGenerator.

60 { Initialize(owner); }
void Initialize(Unit *) override
Definition: IdleMovementGenerator.cpp:75

+ Here is the call graph for this function:

bool DistractMovementGenerator::Update ( Unit ,
uint32  time_diff 
)
overridevirtual

Implements MovementGenerator.

97 {
98  if (time_diff > m_timer)
99  return false;
100 
101  m_timer -= time_diff;
102  return true;
103 }
uint32 m_timer
Definition: IdleMovementGenerator.h:65

Member Data Documentation

uint32 DistractMovementGenerator::m_timer
private

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