-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
340 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
#pragma once | ||
|
||
#include "Option.h" | ||
|
||
class Enemy; | ||
#include "Enemy.h" | ||
|
||
class AttackEnemyOption : public Option { | ||
private: | ||
Enemy* m_enemy; | ||
Enemy::Pointer m_enemy; | ||
|
||
public: | ||
AttackEnemyOption(Enemy* enemy, const std::string& outputText); | ||
AttackEnemyOption(); | ||
|
||
void SetEnemy(Enemy::Pointer enemy) { | ||
m_enemy = enemy; | ||
} | ||
|
||
virtual void Evaluate(Player& player); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "EnemyFactory.h" | ||
#include "Enemy.h" | ||
#include <cassert> | ||
|
||
Enemy* CreateEnemy(EnemyType enemyType) { | ||
Enemy* pEnemy = nullptr; | ||
|
||
switch(enemyType) { | ||
case EnemyType::Dragon: | ||
pEnemy = new Enemy(EnemyType::Dragon); | ||
break; | ||
case EnemyType::Orc: | ||
pEnemy = new Enemy(EnemyType::Orc); | ||
break; | ||
default: | ||
assert(false); //Unknown enemy | ||
break; | ||
} | ||
|
||
return pEnemy; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
class Enemy; | ||
|
||
enum class EnemyType { | ||
Dragon, | ||
Orc, | ||
Max | ||
}; | ||
|
||
Enemy* CreateEnemy(EnemyType enemyType); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include "Visitor.h" | ||
#include "Player.h" | ||
#include "Option.h" | ||
|
||
class EvaluateVisitor : public Visitor { | ||
private: | ||
Player& m_player; | ||
|
||
public: | ||
EvaluateVisitor(Player& player) : m_player { player } {} | ||
|
||
virtual void OnVisit(Visitable& visitable) { | ||
Option* pOption = dynamic_cast<Option*>(&visitable); | ||
|
||
if(pOption != nullptr) { | ||
pOption->Evaluate(m_player); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.