Changeset 885 for 2010/24/anlakane/Muistipeli/Kortti.cs
- Timestamp:
- 2010-06-15 19:46:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/anlakane/Muistipeli/Kortti.cs
r884 r885 11 11 { 12 12 bool onkoKaantynyt; 13 protected Vector alkuperainenKoko; 14 protected enum Kortintila { Kuvapuoli, KaantymassaKuvapuoli, KaantymassaTakapuoli, Takapuoli } 15 Kortintila tila; 13 16 bool kaantyminenAlkanut = false; 14 17 … … 18 21 // TODO: Construct any child components here 19 22 onkoKaantynyt = false; 23 tila = Kortintila.Kuvapuoli; 20 24 IsUpdated = true; 25 this.alkuperainenKoko = new Vector(width, height); 21 26 } 22 27 … … 24 29 { 25 30 kaantyminenAlkanut = true; 31 Pienenna(); 32 } 33 34 protected void Pienenna() 35 { 36 if (tila == Kortintila.Kuvapuoli) 37 { 38 tila = Kortintila.KaantymassaKuvapuoli; 39 } 40 if (tila == Kortintila.Takapuoli) 41 { 42 tila = Kortintila.KaantymassaTakapuoli; 43 } 26 44 } 27 45 … … 32 50 public override void Update(Time time) 33 51 { 34 if ( kaantyminenAlkanut)52 if (tila == Kortintila.KaantymassaKuvapuoli) 35 53 { 36 if(this.Width > 5)54 if(this.Width > 3) 37 55 { 38 this.Size = new Vector(this.Width - 1, this.Height - 1);56 this.Size = new Vector(this.Width - 3, this.Height); 39 57 } 40 if(this.Width <= 5)58 if(this.Width <= 3) 41 59 { 60 tila = Kortintila.KaantymassaTakapuoli; 61 kaantyminenAlkanut = true; 62 } 63 } 64 65 if (tila == Kortintila.KaantymassaTakapuoli) 66 { 67 if (this.Width < this.alkuperainenKoko.X) 68 { 69 this.Size = new Vector(this.Width + 3, this.Height); 70 } 71 if (this.Width >= this.alkuperainenKoko.X) 72 { 73 tila = Kortintila.Takapuoli; 42 74 kaantyminenAlkanut = false; 43 75 } 76 44 77 } 78 79 45 80 // TODO: Add your update code here 46 81 base.Update(time);
Note: See TracChangeset
for help on using the changeset viewer.