- Timestamp:
- 2015-06-11 18:30:23 (8 years ago)
- Location:
- 2015/24/ohjaajat/Dungeon/Dungeon
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/24/ohjaajat/Dungeon/Dungeon/Dungeon/Dungeon.cs
r6034 r6035 36 36 /// </summary> 37 37 public virtual void Built(Dungeon peli) { } 38 39 /// <summary> 40 /// Tätä kutsutaan kun barbaari tulee kylään 41 /// </summary> 42 public virtual void Invasion(Dungeon peli, Barbaari barbaari, Room huone) { } 38 43 } 39 44 … … 41 46 { 42 47 public int Damage { get; set; } 48 49 public override void Invasion(Dungeon peli, Barbaari barbaari, Room huone) 50 { 51 barbaari.Destroy(); //TODO: Mitä nyt oikeasti tapahtuu, kun barbaari astuu ansaan. Meidän tapauksessa kai tapetaan saman tien. 52 } 43 53 } 44 54 … … 74 84 }; 75 85 } 86 87 public override void Invasion(Dungeon peli, Barbaari barbaari, Room huone) 88 { 89 this.Destroy(); 90 peli.kohteet.Remove(huone); 91 if (peli.kohteet.Count < 1) 92 { 93 peli.LopetaPeli(); 94 } 95 } 76 96 } 77 97 … … 112 132 { 113 133 public List<Point> Reitti { get; set; } 114 134 115 135 public Barbaari(double width, double height) 116 : base(width, height)136 : base(width, height) 117 137 { 118 138 Reitti = new List<Point>(); … … 148 168 //static Image kulttuuriKuva3 = LoadImage("spurdo"); 149 169 Image[] kultuuriKuvat = LoadImages("nyan", "es", "spurdo"); 170 Image[] ansaKuvat = LoadImages((from i in Enumerable.Range(1, 7) select String.Format("piikit{0:0000}", i)).ToArray()); 150 171 Image[] vihuKuvat = LoadImages((from i in Enumerable.Range(1, 10) select String.Format("v{0:0000}", i)).ToArray()); 151 172 Image partikkeli = LoadImage("partikkeli"); … … 156 177 157 178 Room[,] huoneet; 158 List<Room> kohteet = new List<Room>();179 public List<Room> kohteet = new List<Room>(); 159 180 List<Barbaari> barbaarit = new List<Barbaari>(); 160 181 Room spawn; … … 226 247 } 227 248 249 public void LopetaPeli() 250 { 251 ClearAll(); 252 GameObject spurdo = new GameObject(Screen.Width, Screen.Height); 253 spurdo.Image = kultuuriKuvat[2]; 254 Add(spurdo); 255 256 Label havisit = new Label("Hävisit muuten belin"); 257 havisit.Color = Color.HotPink; 258 havisit.Size = new Vector(300, 300); 259 havisit.Position = new Vector(Level.Right - havisit.Width * 0.5, Level.Top - havisit.Height * 0.5); 260 Add(havisit); 261 } 262 228 263 void Kauppa() 229 264 { … … 244 279 }; 245 280 246 Mouse.Listen(MouseButton.Right, ButtonState.Pressed, delegate() { ostamassa = null; }, "Perutaan ostos");247 248 281 Label teksti = new Label(); 249 282 teksti.Position = kuva.Position + new Vector((RUUDUN_KOKO * 1.2), 0); … … 251 284 teksti.Text = hinnat[i].ToString(); 252 285 Add(teksti); 253 254 /*for(int i = 0; i<ansaKuvat.Length; i++) 255 { 256 257 }*/ 286 287 } 288 289 for(int i = 0; i<1; i++) 290 { 291 PushButton kuva = new PushButton(ansaKuvat[ansaKuvat.Length - 1]); 292 kuva.Size = new Vector(1, 1) * RUUDUN_KOKO; 293 kuva.Position = new Vector((Level.Right + Level.Width * 0.05), (Level.Top - Level.Height * 0.25 - ((kultuuriKuvat.Count() + i) * RUUDUN_KOKO))); 294 Add(kuva); 258 295 } 259 296 } … … 288 325 barbaari.Kohde = kohteet[RandomGen.NextInt(kohteet.Count)]; 289 326 barbaari.Reitti = FindPath(barbaari.Kohde.Location, (barbaari.Location.Equals(spawn.Location)) ? spawn.Location : barbaari.Location); 290 327 291 328 292 329 } … … 294 331 void Sykli() 295 332 { 296 List<Barbaari> poistettavat = new List<Barbaari>();333 //List<Barbaari> poistettavat = new List<Barbaari>(); //TODO: Ansahuoneet poistamaan barbaareja, ei me. 297 334 foreach (var barbaari in barbaarit) 298 335 { 299 336 if (barbaari.Reitti.Count == 0) 300 337 { 301 kohteet.Remove(barbaari.Kohde); 302 303 if (kohteet.Count > 0) 304 { 305 EtsiBarbaarinReitti(barbaari); //Etsitään uusi reitti poiston sijaan 306 continue; 307 } 308 309 poistettavat.Add(barbaari); 310 barbaari.Destroy(); 311 continue; 338 339 EtsiBarbaarinReitti(barbaari); //Etsitään uusi reitti poiston sijaan 340 341 /*poistettavat.Add(barbaari); 342 barbaari.Destroy(); 343 continue;*/ 312 344 } 313 345 … … 317 349 } 318 350 319 foreach (var poista in poistettavat)320 barbaarit.Remove(poista); 351 /*foreach (var poista in poistettavat) 352 barbaarit.Remove(poista);*/ 321 353 } 322 354 … … 329 361 Room huone = huoneet[uusiPaikka.X, uusiPaikka.Y]; 330 362 331 if (huone != null && huone.Upgrade != null && huone.Upgrade is CultureUpgrade) //Barbaari tuhoaa kultuurihuoneen. 332 { 333 var upg = huone.Upgrade as CultureUpgrade; 334 upg.Destroy(); 363 if (huone.Upgrade != null) 364 { 365 huone.Upgrade.Invasion(this, barbaari, huone); 335 366 } 336 367 } … … 348 379 void SeuraavaAalto() 349 380 { 350 381 351 382 barbaariAjastin.Start(barbaariMaara); 352 383 barbaariMaara += 2; … … 389 420 Dig(GetRoom(kaivettavatPaikat[i]), GetRoom(kaivettavatPaikat[i + 1])); 390 421 } 391 422 392 423 //var alkuHuone = huoneet[digStart.X, digStart.Y]; 393 424 … … 430 461 431 462 Mouse.ListenOn(huone, MouseButton.Left, ButtonState.Pressed, AsetaPaivitys, "Asetetaan ostettu päivitys paikoilleen", huone); 463 Mouse.Listen(MouseButton.Right, ButtonState.Pressed, delegate() { ostamassa = null; }, "Perutaan ostos"); 464 Mouse.ListenOn(huone, MouseButton.Right, ButtonState.Pressed, PoistaPaivitys, "Poistetaan asetettu päivitys", huone); 432 465 433 466 return huone; 467 } 468 469 private void PoistaPaivitys(Room huone) 470 { 471 if (huone.Upgrade != null) 472 { 473 huone.Upgrade.Destroy(); 474 } 434 475 } 435 476 … … 453 494 void PaivitaHuoneidenKultuurit() 454 495 { 455 RuutujenPaikat().Select(GetRoom).ToList().ForEach(PaivitaHuoneenKultuuri); // :D 496 RuutujenPaikat().Select(GetRoom).ToList().ForEach(PaivitaHuoneenKultuuri); // :D ;___;; MIKSI 456 497 } 457 498 -
2015/24/ohjaajat/Dungeon/Dungeon/Dungeon/Dungeon.csproj.Debug.cachefile
r5972 r6035 17 17 Content\v0010.xnb 18 18 Content\partikkeli.xnb 19 Content\piikit0001.xnb 20 Content\piikit0002.xnb 21 Content\piikit0003.xnb 22 Content\piikit0004.xnb 23 Content\piikit0005.xnb 24 Content\piikit0006.xnb 25 Content\piikit0007.xnb -
2015/24/ohjaajat/Dungeon/Dungeon/DungeonContent/DungeonContent.contentproj
r5971 r6035 149 149 </Compile> 150 150 </ItemGroup> 151 <ItemGroup> 152 <Compile Include="piikit0001.png"> 153 <Name>piikit0001</Name> 154 <Importer>TextureImporter</Importer> 155 <Processor>TextureProcessor</Processor> 156 </Compile> 157 <Compile Include="piikit0002.png"> 158 <Name>piikit0002</Name> 159 <Importer>TextureImporter</Importer> 160 <Processor>TextureProcessor</Processor> 161 </Compile> 162 <Compile Include="piikit0003.png"> 163 <Name>piikit0003</Name> 164 <Importer>TextureImporter</Importer> 165 <Processor>TextureProcessor</Processor> 166 </Compile> 167 <Compile Include="piikit0004.png"> 168 <Name>piikit0004</Name> 169 <Importer>TextureImporter</Importer> 170 <Processor>TextureProcessor</Processor> 171 </Compile> 172 <Compile Include="piikit0005.png"> 173 <Name>piikit0005</Name> 174 <Importer>TextureImporter</Importer> 175 <Processor>TextureProcessor</Processor> 176 </Compile> 177 <Compile Include="piikit0006.png"> 178 <Name>piikit0006</Name> 179 <Importer>TextureImporter</Importer> 180 <Processor>TextureProcessor</Processor> 181 </Compile> 182 <Compile Include="piikit0007.png"> 183 <Name>piikit0007</Name> 184 <Importer>TextureImporter</Importer> 185 <Processor>TextureProcessor</Processor> 186 </Compile> 187 </ItemGroup> 151 188 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 152 189 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.