4种情况,四个判断了~
public void boolean isEventTrigger(CauseEvent cEvent, ResultEvent rEvent) {
switch (cEvent) {
case ON_HIT:
switch (rEvent) {
case ON_BOMB:
System.err.println(CauseEvent.ON_HIT + " 击中 爆炸 " + ResultEvent.ON_BOMB);
break;
case ON_REMOVE_BOMB:
System.err.println(CauseEvent.ON_HIT + " 击中 炸弹拆除 " + ResultEvent.ON_BOMB);
break;
}
break;
case ON_CUT_LINE:
switch (rEvent) {
case ON_BOMB:
System.err.println(CauseEvent.ON_HIT + " 剪断引线 爆炸 " + ResultEvent.ON_BOMB);
break;
case ON_REMOVE_BOMB:
System.err.println(CauseEvent.ON_HIT + " 剪断引线 炸弹拆除 " + ResultEvent.ON_BOMB);
break;
}
break;
default:
System.err.println("nothing");
break;
}
return false;
}
public enum CauseEvent {
ON_HIT, // 击中炸弹
ON_CUT_LINE// 剪断引线
}
public enum ResultEvent {
ON_BOMB, // 炸弹爆炸
ON_REMOVE_BOMB// 炸弹拆除
}