Changeset 1587 for 2010/31/saolhaka


Ignore:
Timestamp:
2010-08-04 11:06:12 (9 years ago)
Author:
tekrjant
Message:
 
Location:
2010/31/saolhaka/GuitarZero
Files:
21 added
1 edited

Legend:

Unmodified
Added
Removed
  • 2010/31/saolhaka/GuitarZero/Peli.cs

    r1574 r1587  
    1818    GameObject viivaus; 
    1919 
     20    TimeSpan aloitusAika; 
    2021    Timer nuottienPudotusAjastin; 
    2122    List<GameObject> nuotit; 
     23     
     24    Queue<GameObject> kieli0 = new Queue<GameObject>(); 
     25    Queue<GameObject> kieli1 = new Queue<GameObject>(); 
     26    Queue<GameObject> kieli2 = new Queue<GameObject>(); 
     27    Queue<GameObject> kieli3 = new Queue<GameObject>(); 
     28    Queue<GameObject> kieli4 = new Queue<GameObject>(); 
     29 
    2230    bool seuraavaOnHopo = false; 
     31 
     32    List<bool> onkoPainettu; 
    2333 
    2434    protected override void Begin() 
     
    115125        ClearAll(); 
    116126        AsetaOhjaimet(); 
     127 
     128        onkoPainettu = new List<bool>(); 
     129 
     130        for (int i = 0; i < 5; i++) 
     131        { 
     132            onkoPainettu.Add(false); 
     133        } 
     134 
     135 
    117136        Level.BackgroundColor = Color.Brown; 
    118137        LuoPisteLaskuri(); 
     
    127146    void LuoNuottienPudotusAjastin() 
    128147    { 
     148        aloitusAika = Time.SinceStartOfGame; 
    129149        nuottienPudotusAjastin = new Timer(); 
    130150        nuottienPudotusAjastin.Interval = 0.50; 
     
    138158        double aika = RandomGen.NextDouble(0.10, 0.50); 
    139159        aika = Math.Round(aika, 1); 
    140         if (aika <= 0.2) 
     160 
     161        if (aika <= 0.2 && Time.SinceStartOfGame.TotalSeconds - aloitusAika.TotalSeconds >= 2.0) 
    141162        { 
    142163            seuraavaOnHopo = true; 
     
    275296    void AsetaOhjaimet() 
    276297    { 
    277         Keyboard.Listen(Key.F1, ButtonState.Down, Paina, null, 0); 
    278         Keyboard.Listen(Key.F1, ButtonState.Released, Vapauta, null, 0); 
    279         Keyboard.Listen(Key.F2, ButtonState.Down, Paina, null, 1); 
    280         Keyboard.Listen(Key.F2, ButtonState.Released, Vapauta, null, 1); 
    281         Keyboard.Listen(Key.F3, ButtonState.Down, Paina, null, 2); 
    282         Keyboard.Listen(Key.F3, ButtonState.Released, Vapauta, null, 2); 
    283         Keyboard.Listen(Key.F4, ButtonState.Down, Paina, null, 3); 
    284         Keyboard.Listen(Key.F4, ButtonState.Released, Vapauta, null, 3); 
    285         Keyboard.Listen(Key.F5, ButtonState.Down, Paina, null, 4); 
    286         Keyboard.Listen(Key.F5, ButtonState.Released, Vapauta, null, 4); 
    287     } 
    288  
    289     void Paina(int indeksi) 
     298        Keyboard.Listen(Key.F1, ButtonState.Down, Paina, null, 0, true); 
     299        Keyboard.Listen(Key.F1, ButtonState.Released, Vapauta, null, 0, false); 
     300        Keyboard.Listen(Key.F2, ButtonState.Down, Paina, null, 1, true); 
     301        Keyboard.Listen(Key.F2, ButtonState.Released, Vapauta, null, 1, false); 
     302        Keyboard.Listen(Key.F3, ButtonState.Down, Paina, null, 2, true); 
     303        Keyboard.Listen(Key.F3, ButtonState.Released, Vapauta, null, 2, false); 
     304        Keyboard.Listen(Key.F4, ButtonState.Down, Paina, null, 3, true); 
     305        Keyboard.Listen(Key.F4, ButtonState.Released, Vapauta, null, 3, false); 
     306        Keyboard.Listen(Key.F5, ButtonState.Down, Paina, null, 4, true); 
     307        Keyboard.Listen(Key.F5, ButtonState.Released, Vapauta, null, 4, false); 
     308 
     309        Keyboard.Listen(Key.Enter, ButtonState.Pressed, SoitaNuotti, null); 
     310    } 
     311 
     312    void Paina(int indeksi, bool painettuTila) 
    290313    { 
    291314        fretit[indeksi].Image = fretitPainettuna[indeksi]; 
    292     } 
    293  
    294     void Vapauta(int indeksi) 
     315        onkoPainettu[indeksi] = painettuTila; 
     316    } 
     317 
     318    void SoitaNuotti() 
     319    { 
     320        //nuotit[indeksi].Destroy(); 
     321    } 
     322 
     323    void Vapauta(int indeksi, bool painettuTila) 
    295324    { 
    296325        fretit[indeksi].Image = fretitPainamattomina[indeksi]; 
     326        onkoPainettu[indeksi] = painettuTila; 
    297327    } 
    298328 
Note: See TracChangeset for help on using the changeset viewer.