Ignore:
Timestamp:
2016-06-10 09:30:50 (4 years ago)
Author:
sieerinn
Message:

Loppusäädöt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Punasininen.cs

    r7223 r7224  
    123123            Win(percentageTracker.Value >= 50 ? red : blue); 
    124124            var restart = new Timer() { Interval = 5, IgnorePause = true }; 
    125             restart.Timeout += () => { ClearAll(); Begin(); Pause(); }; 
     125            restart.Timeout += RestartGame; 
    126126            restart.Start(); 
    127127        }; 
     
    186186        Add(player); 
    187187 
     188        var glow = new GameObject(240, 240); 
     189        glow.Image = playersColor == redColor ? orangeGlow : blueGlow; 
     190        player.Add(glow); 
     191 
    188192        player.Weapon = new AssaultRifle(leveys * 1.5, korkeus * 1.5) 
    189193        { 
     
    222226    { 
    223227        int hurdur = RandomGen.NextInt(0, 3); 
     228        Image glow = player == red ? orangeGlow : blueGlow; 
    224229 
    225230        switch (hurdur) 
    226231        { 
    227232            case 0: 
    228                 player.Weapon = new RocketLauncher(player.Weapon.Width, player.Weapon.Height, player.Weapon.Image, player); 
     233                player.Weapon = new RocketLauncher(player.Weapon.Width, player.Weapon.Height, player.Weapon.Image, glow, player); 
    229234                break; 
    230235            case 1: 
    231                 player.Weapon = new GrenadeLauncher(player.Weapon.Width, player.Weapon.Height, player.Weapon.Image, player); 
     236                player.Weapon = new GrenadeLauncher(player.Weapon.Width, player.Weapon.Height, player.Weapon.Image, glow, player); 
    232237                break; 
    233238            case 2: 
    234                 player.Weapon = new LaserGun(player.Weapon.Width, player.Weapon.Height) { Image = player.Weapon.Image, ProjectileCollision = delegate (PhysicsObject a, PhysicsObject b) { ColorTile(a, b); a.Destroy(); }, AttackSound = null, MaxAmmoLifetime = TimeSpan.FromSeconds(4) }; 
     239                player.Weapon = new SprayGun(player.Weapon.Width, player.Weapon.Height, player.Weapon.Image, glow, player); 
    235240                break; 
    236241            default: 
     
    256261    } 
    257262 
     263    void RestartGame() 
     264    { 
     265        cratePositions.Clear(); 
     266        ClearAll(); 
     267        Begin(); 
     268        IsPaused = false; 
     269    } 
     270 
    258271    void Win(Player winner) 
    259272    { 
     
    285298        zoomTimer.IgnorePause = true; 
    286299        zoomTimer.Start(); 
    287  
    288         cratePositions.Clear(); 
    289300    } 
    290301 
     
    323334 
    324335        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Ohjeet"); 
     336        Keyboard.Listen(Key.F12, ButtonState.Pressed, RestartGame, null); 
    325337        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Lopeta"); 
    326338 
Note: See TracChangeset for help on using the changeset viewer.