TrinityCore
FleeingMovementGenerator.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_FLEEINGMOVEMENTGENERATOR_H
19#define TRINITY_FLEEINGMOVEMENTGENERATOR_H
20
21#include "MovementGenerator.h"
22#include "ObjectGuid.h"
23#include "Timer.h"
24
25class PathGenerator;
26struct Position;
27
29{
30 public:
31 explicit FleeingMovementGenerator(ObjectGuid fleeTargetGUID);
32
34
35 void Initialize(Unit* owner) override;
36 void Reset(Unit* owner) override;
37 bool Update(Unit* owner, uint32 diff) override;
38 void Deactivate(Unit* owner) override;
39 void Finalize(Unit* owner, bool, bool) override;
40
42
43 private:
44 void SetTargetLocation(Unit* owner);
45 void GetPoint(Unit* owner, Position& position) const;
46
47 std::unique_ptr<PathGenerator> _path;
50};
51
53{
54 public:
55 explicit TimedFleeingMovementGenerator(ObjectGuid fleeTargetGUID, Milliseconds time) : FleeingMovementGenerator(fleeTargetGUID), _totalFleeTime(time) { }
56
57 bool Update(Unit*, uint32) override;
58 void Finalize(Unit*, bool, bool) override;
60
61 private:
63};
64
65#endif
uint32_t uint32
Definition: Define.h:142
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
MovementGeneratorType
@ MOVEMENTGENERATOR_FLAG_SPEED_UPDATE_PENDING
void GetPoint(Unit *owner, Position &position) const
void Deactivate(Unit *owner) override
FleeingMovementGenerator(ObjectGuid fleeTargetGUID)
void Reset(Unit *owner) override
bool Update(Unit *owner, uint32 diff) override
std::unique_ptr< PathGenerator > _path
void Initialize(Unit *owner) override
MovementGeneratorType GetMovementGeneratorType() const override
void Finalize(Unit *owner, bool, bool) override
void AddFlag(uint16 const flag)
bool Update(Unit *, uint32) override
MovementGeneratorType GetMovementGeneratorType() const override
void Finalize(Unit *, bool, bool) override
TimedFleeingMovementGenerator(ObjectGuid fleeTargetGUID, Milliseconds time)
Definition: Unit.h:627