public bool TestIncomingLight(LIGHT_COLOR incoming_color) { bool ret_value = false; switch (my_light_color) { case LIGHT_COLOR.RED: case LIGHT_COLOR.BLUE: case LIGHT_COLOR.YELLOW: if (incoming_color == my_light_color) { is_being_charged_by_radiance = true; ret_value = true; } break; case LIGHT_COLOR.GREEN: { if (incoming_color == LIGHT_COLOR.YELLOW) { charge_color_1 = true; ret_value = true; } else if (incoming_color == LIGHT_COLOR.BLUE) { charge_color_2 = true; ret_value = true; } else if (incoming_color == my_light_color) { is_being_charged_by_radiance = true; ret_value = true; } else { if (IsPrimaryColor(incoming_color)) { kill_charge = true; } } break; } case LIGHT_COLOR.PURPLE: { if (incoming_color == LIGHT_COLOR.RED) { charge_color_1 = true; ret_value = true; } else if (incoming_color == LIGHT_COLOR.BLUE) { charge_color_2 = true; ret_value = true; } else if (incoming_color == my_light_color) { is_being_charged_by_radiance = true; ret_value = true; } else { if (IsPrimaryColor(incoming_color)) { kill_charge = true; } } break; } case LIGHT_COLOR.ORANGE: { if (incoming_color == LIGHT_COLOR.YELLOW) { charge_color_1 = true; ret_value = true; } else if (incoming_color == LIGHT_COLOR.RED) { charge_color_2 = true; ret_value = true; } else if (incoming_color == my_light_color) { is_being_charged_by_radiance = true; ret_value = true; } else { if (IsPrimaryColor(incoming_color)) { kill_charge = true; } } break; } default: ret_value = false; break; } return ret_value; }
bool IsPrimaryColor(LIGHT_COLOR color) { switch (color) { case LIGHT_COLOR.RED: case LIGHT_COLOR.BLUE: case LIGHT_COLOR.YELLOW: return true; break; } return false; }