Erwan
- Send an event when Phase changes
This commit is contained in:
@@ -80,8 +80,15 @@ void GameObserver::nextPlayer(){
|
||||
|
||||
}
|
||||
void GameObserver::nextGamePhase(){
|
||||
Phase * cPhaseOld = phaseRing->getCurrentPhase();
|
||||
phaseRing->forward();
|
||||
Phase * cPhase = phaseRing->getCurrentPhase();
|
||||
|
||||
//Warn the layers about the phase Change
|
||||
WEvent * e = NEW WEventPhaseChange(cPhaseOld, cPhase);
|
||||
receiveEvent(e);
|
||||
delete e;
|
||||
|
||||
currentGamePhase = cPhase->id;
|
||||
if (currentPlayer != cPhase->player) nextPlayer();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "../include/MTGCardInstance.h"
|
||||
#include "../include/MTGGameZones.h"
|
||||
#include "../include/Damage.h"
|
||||
#include "../include/PhaseRing.h"
|
||||
|
||||
WEvent::WEvent(int _type){
|
||||
type=_type;
|
||||
@@ -15,4 +16,9 @@ WEventZoneChange::WEventZoneChange(MTGCardInstance * _card, MTGGameZone * _from,
|
||||
|
||||
WEventDamage::WEventDamage(Damage *_damage):WEvent(DAMAGE){
|
||||
damage = _damage;
|
||||
}
|
||||
|
||||
WEventPhaseChange::WEventPhaseChange(Phase * _from, Phase * _to):WEvent(CHANGE_PHASE){
|
||||
from = _from;
|
||||
to = _to;
|
||||
}
|
||||
Reference in New Issue
Block a user