示例#1
0
    //if entering from the <inputDirection> (east, west, etc.), which way will you go after passing through this tile?
    public int getOutputDirection(int enteringFrom)
    {
        if (turnCount == 1)
        {
            return(turnMod.isActive() ? turnMod.getOutputDirection(enteringFrom) : getOppositeDirection(enteringFrom));
//			case 2:
//				int dir = TurnLightsModel.getSharedDirection(turnMod, turnMod2);
//				if (dir != -1 && // if they overlap
//				        (enteringFrom == turnMod.getOutputDirection(dir) ||
//						enteringFrom == turnMod2.getOutputDirection(dir))) { // and the input leads to the overlapping direction
//					return dir; // return overlapping direction
//				}
//				else {
//					if (turnMod.isActive()) {
//						return turnMod.getOutputDirection(enteringFrom);
//					}
//					else {
//						return turnMod2.getOutputDirection(enteringFrom);
//					}
//				}
        }
        else
        {
            return(getOppositeDirection(enteringFrom));
        }
    }