Beispiel #1
0
 public static Part TransitionTo (Part from, Analyzer.Node.Part to, float cur_second) {
     if (!IsArcValid(from, to)) {
         throw new ArgumentException();
     }
     if (to == null) {
         throw new ArgumentException();
         /*return new Part(
             from.movement,
             from.panel,
             cur_second,
             from.cur_moved_second,
             from.prv_moved_second
         );*/
     } else {
         Movement nxt_movement = MovementHelper.TransitionTo(from.movement, to.movement);
         if (nxt_movement == Movement.PassiveDown) {
             if (from.movement == Movement.PassiveDown) {
                 return new Part(nxt_movement, from.panel, cur_second, from.cur_moved_second, from.prv_moved_second);
             } else {
                 return new Part(nxt_movement, from.panel, cur_second, cur_second, from.cur_moved_second);
             }
         } else {
             return new Part(nxt_movement, to.panel, cur_second, cur_second, from.cur_moved_second);
         }
     }
 }
Beispiel #2
0
 public static bool IsArcValid (Part from, Analyzer.Node.Part to) {
     if (to == null) { return true; }
     if (!MovementHelper.IsArcValid(from.movement, to.movement)) {
         return false;
     }
     //Transition is valid if we consider movement only
     //Consider hold notes
     if (from.movement == Movement.ForceDownStart) {
         if (to.movement == Analyzer.Node.Movement.StayDown) {
             return from.panel == to.panel; //Continue hold note
         } else if (to.movement == Analyzer.Node.Movement.Relax) {
             return from.panel == to.panel; //End hold note
         } else {
             throw new ArgumentException();
         }
     } else if (from.movement == Movement.ForceDown) {
         if (to.movement == Analyzer.Node.Movement.StayDown) {
             return from.panel == to.panel; //Continue hold note
         } else if (to.movement == Analyzer.Node.Movement.Relax) {
             return from.panel == to.panel; //End continued hold note
         } else {
             throw new ArgumentException();
         }
     }
     return true;
 }
Beispiel #3
0
 public static Part ToUnknown (Part src, float cur_second) {
     Part result = new Part(
         Movement.Unknown,
         null,
         cur_second,
         src.cur_moved_second, //TODO decide if we consider going to unknown "just moving"
         src.prv_moved_second
     );
     return result;
 }
Beispiel #4
0
 public static Part ToPassiveDown (Part src, float cur_second) {
     Part result = new Part(
         Movement.PassiveDown,
         src.panel,
         cur_second,
         src.cur_moved_second,
         src.prv_moved_second
     );
     return result;
 }
Beispiel #5
0
 public static Part DirectCopy (Part src) {
     Part result = new Part(
         src.movement,
         src.panel,
         src.cur_second,
         src.cur_moved_second,
         src.prv_moved_second
     );
     return result;
 }
Beispiel #6
0
 public Part this[int index] {
     get { return m_Parts[index]; }
     set {
         m_Parts[index] = value;
         switch (index) {
             case INDEX_MAIN: m_Main = value; return;
             case INDEX_SUB: m_Sub = value; return;
             case INDEX_EXTRA: m_Extra = value; return;
         }
     }
 }
Beispiel #7
0
 public static Limb[] CloneWithHover (Limb[] src, int limb_index, float cur_second, params int[] part_index) {
     Limb[] dst = new Limb[src.Length];
     for (int i = 0; i < src.Length; ++i) {
         dst[i] = Limb.DirectCopy(src[i]);
         if (i == limb_index) {
             foreach (int p in part_index) {
                 dst[i][p] = new Part(
                     Movement.Unknown,
                     null,
                     dst[i][p].cur_second,
                     dst[i][p].cur_moved_second,
                     dst[i][p].prv_moved_second
                 );
             }
         }
         dst[i].sanityCheck();
     }
     return dst;
 }
Beispiel #8
0
 public static Part ToUnknown (Part src) {
     return ToUnknown(src, src.cur_second);
 }