blob: 267ccf7ea6a6152605fb35743e8f3a741a317c29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
#include "Goal.h"
#include "EntitySelector.h"
class PathNavigation;
class PathfinderMob;
class Path;
class AvoidPlayerGoal;
class AvoidPlayerGoalEntitySelector : public EntitySelector
{
private:
AvoidPlayerGoal *m_parent;
public:
AvoidPlayerGoalEntitySelector(AvoidPlayerGoal *parent);
bool matches(shared_ptr<Entity> entity) const;
};
class AvoidPlayerGoal : public Goal
{
friend class AvoidPlayerGoalEntitySelector;
private:
PathfinderMob *mob; // Owner of this goal
double walkSpeedModifier, sprintSpeedModifier;
weak_ptr<Entity> toAvoid;
float maxDist;
Path *path;
PathNavigation *pathNav;
const type_info& avoidType;
EntitySelector *entitySelector;
public:
AvoidPlayerGoal(PathfinderMob *mob, const type_info& avoidType, float maxDist, double walkSpeedModifier, double sprintSpeedModifier);
~AvoidPlayerGoal();
virtual bool canUse();
virtual bool canContinueToUse();
virtual void start();
virtual void stop();
virtual void tick();
};
|