示例#1
0
 void space_release()
 {
     if (pressed == true)
     {
         pressed = false;
         if (pressed_star != -1)
         {
             // There is a line from a star.
             if (GameDad.is_green(pressed_star) && GameDad.get_green(pressed_star).type == greenstar.Type.Green)
             {
                 // The star is green.
                 if (GameDad.selectedStar != -1)
                 {
                     // The line goes to another star.
                     if (!too_far(pressed_star_position - GameDad.selectedStarLocation))
                     {
                         // The line is not too long.
                         GameDad.linedrawn_hook(pressed_star,
                                                pressed_star_position,
                                                GameDad.selectedStar,
                                                GameDad.selectedStarLocation);
                     }
                 }
             }
         }
         else
         {
             // The player held the space key down without having a star selected.
             if (line != null)
             {
                 throw new Exception("there should be no line allocated, but there is");
             }
         }
         pressed_star = -1;
         GameDad.setmode(StarInstantiatorMode.GreenSelect);
     }
     if (line != null)
     {
         DeRez(line);
     }
 }