- Timestamp:
- 2016-07-04 15:02:15 (7 years ago)
- Location:
- 2015/koodauskerho/AakeR/IMBT
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/koodauskerho/AakeR/IMBT/IMBT/IMBT/IMBT.cs
r7674 r7728 12 12 public DoubleMeter healthit; 13 13 public bool savuttaa = false; 14 public bool boosti= true;14 public bool erikoiskyky = true; 15 15 public AssaultRifle Ase; 16 16 public bool telaJaljetLimit; … … 20 20 public GamePad kontrolleri; 21 21 public Timer liekkiAjastin; 22 public double Nopeus ;22 public double Nopeus = 1000; 23 23 24 24 public GameObject tahtain; … … 249 249 MultiSelectWindow alkuValikko; 250 250 int pelaajienMaara = 2; 251 double maxNopeus = 1000.0;252 251 253 252 List<Pelaaja> pelaajat = new List<Pelaaja>(); … … 339 338 pelaaja.tahtain.Move(suunta); 340 339 } 340 341 341 } 342 342 343 343 Pelaaja LuoPelaaja(Vector paikka, double leveys, double korkeus, int pelaajanr) 344 344 { 345 int valinta = RandomGen.NextInt(pelaaja1Koneet.Length);346 //int valinta = 2;345 //int valinta = RandomGen.NextInt(pelaaja1Koneet.Length); 346 int valinta = 3; 347 347 348 348 Pelaaja pelaaja = new Pelaaja(leveys * 0.8, korkeus * 0.8, valinta, pelaajienKoneet[pelaajanr - 1][valinta], pelaajienTykit[pelaajanr - 1][valinta], rajahdysKuva, liekkiKuva, LoadSoundEffect("TankkiAani")); 349 349 pelaaja.AngularDamping = 0.95; 350 pelaaja.Position = paikka; 350 pelaaja.Position = paikka; 351 351 352 352 GamePad[] kontrollerit = { ControllerOne, ControllerTwo, ControllerThree, ControllerFour }; … … 357 357 kontrollerit[pelaajanr - 1].Listen(Button.LeftTrigger, ButtonState.Pressed, Ammu, "", pelaaja, "raketti", valinta); 358 358 kontrollerit[pelaajanr - 1].Listen(Button.RightShoulder, ButtonState.Pressed, Ammu, "", pelaaja, "pallo", valinta); 359 kontrollerit[pelaajanr - 1].Listen(Button.LeftShoulder, ButtonState.Pressed, Boosti, "", pelaaja, valinta);359 kontrollerit[pelaajanr - 1].Listen(Button.LeftShoulder, ButtonState.Pressed, Erikoiskyky, "", pelaaja, valinta); 360 360 361 361 if (valinta == 3) … … 366 366 Add(tahtain, 3); 367 367 pelaaja.tahtain = tahtain; 368 pelaaja.Destroyed += tahtain.Destroy; 368 369 369 370 Timer ajastin = new Timer(); … … 381 382 if (valinta == 2) 382 383 { 383 maxNopeus = 800.0;384 pelaaja.Nopeus = 800.0; 384 385 } 385 386 … … 490 491 } 491 492 492 pelaaja.Push(tatinTila.StateVector * maxNopeus);493 pelaaja.Push(tatinTila.StateVector * pelaaja.Nopeus); 493 494 } 494 495 … … 819 820 } 820 821 821 void Boosti(Pelaaja pelaaja, int konenr)822 void Erikoiskyky(Pelaaja pelaaja, int konenr) 822 823 { 823 824 // Koneelle 0 pelkkä boosti 824 if (pelaaja. boosti)825 if (pelaaja.erikoiskyky) 825 826 { 826 827 int nopeus = 1000; 827 828 828 // Koneelle 1 näkymättömyys 829 // Koneelle 1 näkymättömyys ja boosti 829 830 if (konenr == 1) 830 831 { … … 834 835 pelaaja.Ase.IsVisible = false; 835 836 836 Timer.SingleShot(1. 75, delegate837 Timer.SingleShot(1.25, delegate 837 838 { 838 839 pelaaja.IsVisible = true; … … 841 842 } 842 843 844 if (konenr == 3) 845 { 846 GameObject valahdys = new GameObject(6000, 6000); 847 valahdys.LifetimeLeft = TimeSpan.FromSeconds(0.6); 848 valahdys.FadeColorTo(Color.Transparent, 0.5); 849 Add(valahdys, 3); 850 851 pelaaja.erikoiskyky = false; 852 853 Timer.SingleShot(6.0, delegate 854 { 855 pelaaja.erikoiskyky = true; 856 }); 857 858 foreach (var ammus in GetObjectsWithTag("perusAmmus")) 859 { 860 ammus.Destroy(); 861 } 862 foreach (var ammus in GetObjectsWithTag("raketti")) 863 { 864 ammus.Destroy(); 865 } 866 foreach (var ammus in GetObjectsWithTag("pallo")) 867 { 868 ammus.Destroy(); 869 } 870 foreach (var ammus in GetObjectsWithTag("haulikko")) 871 { 872 ammus.Destroy(); 873 } 874 foreach (var ammus in GetObjectsWithTag("supersniperammus")) 875 { 876 ammus.Destroy(); 877 } 878 return; 879 } 880 843 881 // Koneelle 2 pelkkä shield, ei boostia 844 882 if (konenr == 2) … … 855 893 pelaaja.vahinkoKerroin = 0; 856 894 857 pelaaja. boosti= false;895 pelaaja.erikoiskyky = false; 858 896 shieldAani.Play(); 859 897 … … 868 906 Timer.SingleShot(5.75, delegate 869 907 { 870 pelaaja. boosti= true;908 pelaaja.erikoiskyky = true; 871 909 }); 872 910 … … 874 912 } 875 913 876 pelaaja. boosti= false;914 pelaaja.erikoiskyky = false; 877 915 pelaaja.Hit(pelaaja.Angle.GetVector() * nopeus); 878 916 boostiAani.Play(); 879 917 Timer.SingleShot(4.5, delegate 880 918 { 881 pelaaja. boosti= true;919 pelaaja.erikoiskyky = true; 882 920 }); 921 922 883 923 } 884 924
Note: See TracChangeset
for help on using the changeset viewer.