Beispiel #1
0
 private float CalculateTooFast (
     Limb cur, Limb prv,
     Beat cur_beat, Beat prv_beat
 ) {
     if (IsGallop(cur, prv, cur_beat, prv_beat)) {
         return 0.0f;
     }
     if (
         cur_beat.beat_interval < GALLOP_BEAT_INTERVAL ||
         prv_beat.beat_interval < GALLOP_BEAT_INTERVAL
     ) {
         return 0.0f; //Consider making it.. 24?
     }
     float delta_second = cur_beat.second - prv_beat.second;
     if (
         delta_second > (cur_beat.seconds_per_beat / GALLOP_BEATS_PER_MEASURE + GALLOP_SECONDS_EPOCH) * 2.0f) {
         return 0.0f; //Unsure if this is correct..
     }
     List<int> cur_indices = cur.JustMovedIndices();
     List<int> prv_indices = prv.JustMovedIndices();
     if (cur_indices.Count == 0 || prv_indices.Count == 0) {
         return 0.0f;
     }
     float cost = 0.0f;
     for (int c = 0; c < cur_indices.Count; ++c) {
         int cur_index = cur_indices[c];
         Part cur_part = cur[cur_index];
         for (int p = 0; p < prv_indices.Count; ++p) {
             int prv_index = prv_indices[p];
             Part prv_part = prv[prv_index];
             if (cur_part.IsUnknown() || prv_part.IsUnknown()) { continue; }
             if (cur_index == prv_index) {
                 if (cur_part.panel == prv_part.panel) {
                     //Do nothing?
                 } else {
                     cost += TOO_FAST_COST;
                 }
             } else {
                 if (cur_part.panel == prv_part.panel) {
                     //Different parts but same panel, a.. part switch?
                     cost += TOO_FAST_COST;//For now, treat it as too fast
                 } else if (Panel.IsBracketable(cur_part.panel.index, prv_part.panel.index)) {
                     //Do nothing, it's a gallop-ish thing
                 } else {
                     //Too fast, probably
                     cost += TOO_FAST_COST;
                 }
             }
         }
     }
     return cost;
 }