Ignore:
Timestamp:
2014-07-25 12:29:43 (5 years ago)
Author:
anlakane
Message:

Esittelyversio

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/MiskaK/The Reclaim/The Reclaim/The Reclaim/The Reclaim/The_Reclaim.cs

    r5652 r5689  
    3535    private Vector ShootingTargetCorner; 
    3636 
    37 #if !DEBUG 
    38     Label waterprint = new Label("The Reclaim (development version)\n by Miska Kananen"); 
    39 #endif 
     37    private HUD BehaviourHUD; 
    4038    #endregion 
    4139 
     
    4543    { 
    4644        Peli = this; 
    47 #if !DEBUG 
    48         waterprint.Position = new Vector(Screen.Left + waterprint.Width / 2, Screen.Bottom + 30); 
    49         waterprint.TextScale = new Vector(0.8, 0.8); 
    50         waterprint.TextColor = Color.White; 
    51         Add(waterprint); 
    52 #endif 
    5345        MainMenu(); 
    5446    } 
     
    6456        LoadLevel(1); 
    6557        SetControls(); 
     58        CreateHUD(); 
    6659        InitializeAI(); 
     60        Sounds.PlayMusic(Sounds.Songs.Hitman, true); 
    6761        Level.AmbientLight = 0.0; 
    6862        KirkastaRuutua(0.03, 1.0); 
    6963    } 
    7064 
    71     void EndGame() 
    72     { 
    73  
     65    void EndGame(bool didWin) 
     66    { 
    7467        ClearAll(); 
     68        Camera.Reset(); 
     69        if (!didWin) 
     70        { 
     71            GameObject gameover = new GameObject(Images.GameOver); 
     72            Add(gameover); 
     73        } 
     74        else 
     75        { 
     76            GameObject areacleared = new GameObject(Images.AreaCleared); 
     77            Add(areacleared); 
     78        } 
     79        KirkastaRuutua(0.05, 1.0); 
     80        Timer.SingleShot(4.0, delegate { PimennaRuutua(0.05, 0.0); }); 
     81        Timer.SingleShot(11.0, delegate { 
     82            ClearAll(); 
     83            Sounds.FadeMusic(0.03, 0.0, delegate { MediaPlayer.Stop(); }); 
     84        }); 
    7585    } 
    7686 
     
    8696        { 
    8797            PimennaRuutua(0.01, 0.0); 
    88             Timer.SingleShot(12.0, EndGame); 
     98            Timer.SingleShot(12.0, delegate { EndGame(false); }); 
     99            CurrentLevel.Entrances.ForEach(x => x.SpawningEnabled = false); 
     100            Mouse.Disable(MouseButton.Left); 
     101            Mouse.Disable(MouseButton.Right); 
    89102        } 
    90103 
     
    95108                FriendlyTroops[i].TargetLocation = CurrentLevel.ExitPoint; 
    96109                FriendlyTroops[i].CurrentBehaviour = Behaviour.Move; 
    97                 Timer.SingleShot(20.0, delegate { PimennaRuutua(0.01, 0.0); }); 
    98                 Timer.SingleShot(28.0, EndGame); 
    99110            } 
    100         } 
     111            Timer.SingleShot(20.0, delegate { PimennaRuutua(0.01, 0.0); }); 
     112            Timer.SingleShot(30.0, delegate { EndGame(true); }); 
     113            CurrentLevel.Entrances.ForEach(x => x.SpawningEnabled = false); 
     114            Mouse.Disable(MouseButton.Left); 
     115            Mouse.Disable(MouseButton.Right); 
     116            SelectedTroops.Clear(); 
     117            SelectedTroops.ForEach(x => x.SelectionMarker.IsVisible = false);  
     118        } 
     119 
     120        /*if (hostileEntrances == 1) 
     121        { 
     122            CurrentLevel.Entrances.Find(x => x.CurrentOwner == Entrance.Owner.Enemy).SpawnTimer.Interval = GameConstants.LAST_ENTRANCE_SPAWN_DELAY; 
     123        } 
     124        else if (hostileEntrances == 2) 
     125        { 
     126            CurrentLevel.Entrances.FindAll(x => x.CurrentOwner == Entrance.Owner.Enemy).ForEach(x => x.SpawnTimer.Interval = RandomGen.NextDouble(GameConstants.MINIMUM_SPAWN_DELAY, GameConstants.MAXIMUM_SPAWN_DELAY)); 
     127        }*/ 
    101128    } 
    102129 
     
    276303    #endregion 
    277304 
     305    #region HUD 
     306 
     307    void CreateHUD() 
     308    { 
     309        Layer.CreateStaticLayer(); 
     310        BehaviourHUD = new HUD(new Vector(Screen.Left + 25, Screen.Bottom + 25), Images.IdleButton, Images.MoveButton, Images.ShootButton, 4); 
     311        BehaviourHUD.Clicked += delegate(Behaviour b) { CurrentBehaviour = b; }; 
     312    } 
     313 
     314    void RefreshHUD(Behaviour currentBehaviour) 
     315    { 
     316        BehaviourHUD.Refresh(currentBehaviour); 
     317    } 
     318 
     319    #endregion 
     320 
    278321    #region kentta 
    279322 
     
    305348            CurrentLevel.ExitPoint = p; }); 
    306349        walls.Execute(GameConstants.TILE_WIDTH, GameConstants.TILE_HEIGHT); 
    307  
    308  
    309  
    310         /*ColorTileMap roofs = new ColorTileMap(data.Roofs); 
    311         roofs.SetTileMethod(Color.DarkGray, CreateRoof, Color.DarkGray); 
    312         roofs.Execute(GameConstants.TILE_WIDTH, GameConstants.TILE_HEIGHT);*/ 
    313  
    314         //GameObject fogOfWar = new GameObject(backgroundImage.Width, backgroundImage.Height); 
    315         //fogOfWar.Image = new Image(data.GroundTexture.Width, data.GroundTexture.Height, Color.Black); 
    316         //Add(fogOfWar, 2); 
    317  
    318         //Timer fowTimer = new Timer(); 
    319         //fowTimer.Interval = 0.1; 
    320         //fowTimer.Timeout += delegate { UpdateFoW(fogOfWar); }; 
    321         //fowTimer.Start();       
    322350    } 
    323351 
     
    353381            e.Spawn(5, -1); 
    354382        CurrentLevel.Entrances.Add(e); 
     383        e.Captured += delegate { e.Spawn(); }; 
    355384    } 
    356385 
     
    536565    { 
    537566        CurrentBehaviour = action; 
    538         MessageDisplay.Add("Current action: " + action.ToString()); 
     567        RefreshHUD(action); 
    539568    } 
    540569     
Note: See TracChangeset for help on using the changeset viewer.