Example #1
0
 public Form1()
 {
     SetStyle(ControlStyles.OptimizedDoubleBuffer |
              ControlStyles.AllPaintingInWmPaint |
              ControlStyles.UserPaint, true);
     InitializeComponent();
     this.BackColor = Color.Black;
     this.Size      = new Size(VALUES.WIDTH, VALUES.HEIGHT + VALUES.PLAYER_HEIGHT);
     if (false)
     {
         setup            = new Setup.LevelSetup();
         this.MouseClick += MousePop;
         this.KeyDown    += SetupKeyHandle;
     }
     InitializePlayer();
     StarMap.GenerateRandomMap(STAR_MAP_FILE, 150, currentPlayerTier);
     level = new StarMap(playerStar, STAR_MAP_FILE, new List <int> {
     }, PrepareNextLevel);
     level.Begin();
     PLAY();
     this.KeyUp    += KeyUps;
     this.Paint    += PaintGame;
     timer          = new Timer();
     timer.Interval = 100;
     timer.Tick    += new EventHandler(Elapse);
     timer.Start();
 }
Example #2
0
 public void HandlePlayer(char key)
 {
     if (key == 'c')
     {
         equipment = new ChangingRoom();
         PrepareSecondView();
     }
 }
Example #3
0
 private void SetTierFinishLevel(Setup.LevelInfoHolder info, ILevelBuilder builder)
 {
     builder
     .SetPlayer(player)
     .SetDescription("Tier finish level")
     .SetFinishedAction(TierFinishedAction)
     .SetContent(info);
     level = builder.Build();
 }
Example #4
0
 public void HandlePlayer(char key)
 {
     if ((key == ' ' && playerStar.Value.isValid) || Form1.player.Fuel == 0)
     {
         Finished(true);
     }
     else if (key == 'c')
     {
         secondView = new ChangingRoom();
         PrepareSecondView();
     }
     else if (key == 'f')
     {
         secondView = new AssemblyRoom();
         PrepareSecondView();
     }
 }
Example #5
0
 private void TierFinishedAction(bool playerWon)
 {
     if (playerWon)
     {
         if (currentPlayerTier == Tier.T3)
         {
             throw new NotImplementedException("You won");
         }
         currentPlayerTier = (Tier)((int)currentPlayerTier + 1);
         player.Fuel       = 15;
         StarMap.GenerateRandomMap(STAR_MAP_FILE, 150, currentPlayerTier);
         level = new StarMap(playerStar, STAR_MAP_FILE, new List <int> {
         }, PrepareNextLevel);
         level.Begin();
     }
     else
     {
         throw new NotImplementedException("You lose");
     }
 }
Example #6
0
 private void PrepareSecondView()
 {
     secondView.Finished += b => { RetrieveControl(); secondView = null; };
     GrantControlToSecondView();
     secondView.Begin();
 }
Example #7
0
 public void Begin()
 {
     secondView          = null;
     currentDraw         = DefaultDraw;
     currentMouseHandler = DefaultMouseHandler;
 }
Example #8
0
 public void Begin()
 {
     equipment           = null;
     currentDraw         = DefaultDraw;
     currentMouseHandler = DefaultMouseHandler;
 }
Example #9
0
 private void PrepareSecondView()
 {
     equipment.Finished += b => { RetrieveControl(); equipment = null; };
     GrantControlToSecondView();
     equipment.Begin();
 }
Example #10
0
 private void ActivateStarMap()
 {
     emptyStars.Add(playerStar);
     level = new StarMap(playerStar, STAR_MAP_FILE, emptyStars, PrepareNextLevel);
 }