public void TestSetFireModeWhenItDoesNotChange() { AssaultRifle testWeapon = new AssaultRifle(FireModeEnum.FullAuto); Assert.IsFalse(testWeapon.SetFireMode(FireModeEnum.FullAuto)); Assert.AreEqual(testWeapon.FireMode, (int)FireModeEnum.FullAuto); }
public override void Begin() { TileMap kentta = TileMap.FromLevelAsset("kentta1"); kentta.SetTileMethod('h', LuoTalo); kentta.SetTileMethod('f', LuoLattia); kentta.SetTileMethod('t', LuoPuu); PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); kentta.Execute(16, 16); kentta.Optimize('f'); pelaaja1 = new PhysicsObject(40, 40); Add(pelaaja1); Camera.Follow(pelaaja1); Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-150, 0)); Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, new Vector(150, 0)); Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 150)); Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -150)); pelaajan1Ase = new AssaultRifle(30, 10); pelaajan1Ase.Ammo.Value = 1000; pelaaja1.Add(pelaajan1Ase); }
public ConcreteMediator() { minigun = new Minigun(this); assaultRifle = new AssaultRifle(this); flamethrower = new Flamethrower(this); shotgun = new Shotgun(this); sniperRifle = new SniperRifle(this); assaultRifleGreen = new AssaultRifle(this); new GreenLaser(assaultRifleGreen, this); assaultRifleRed = new AssaultRifle(this); new RedLaser(assaultRifleRed, this); sniperRifleGreen = new SniperRifle(this); new GreenLaser(sniperRifleGreen, this); sniperRifleRed = new SniperRifle(this); new RedLaser(sniperRifleRed, this); weaponsList = new List <Weapon>(); weaponsList.Add(minigun); weaponsList.Add(assaultRifle); weaponsList.Add(flamethrower); weaponsList.Add(shotgun); weaponsList.Add(sniperRifle); weaponsList.Add(assaultRifleGreen); weaponsList.Add(assaultRifleRed); weaponsList.Add(sniperRifleGreen); weaponsList.Add(sniperRifleRed); }
[UsedImplicitly] void Start() { MainWeapon = new AssaultRifle(); SecondaryWeapon = new AssaultRifle(); CurrentWeapon = MainWeapon; if (MaxAmmo == 0) //Prevents warning. Remove when implemented! { fireTimer = 0; } Ammo = MaxAmmo; AmmoInClip = MaxClip; fireTimer = 0f; CurrentHealth = maxHealth; rigidBody = GetComponent <Rigidbody>(); rigidBody.freezeRotation = true; networkView = GetComponent <NetworkView>(); playerRigidbody = GetComponent <Rigidbody>(); currentlyColliding = new HashSet <Collider>(); // currentTree = null; if (networkView.isMine) { var cameraObj = new GameObject("squirrell camera"); cameraObj.transform.parent = transform; var camera = cameraObj.AddComponent <Camera>(); camera.transform.localPosition = new Vector3(0, 10, -20); cameraObj.AddComponent <CameraVert>(); } anim = GetComponent <Animator>(); }
public void TestSetFireModeWhenItDoesChange() { AssaultRifle testWeapon = new AssaultRifle(FireModeEnum.FullAuto); testWeapon.SetFireMode(FireModeEnum.ThreeShotBurst); Assert.AreEqual(testWeapon.FireMode, (int)FireModeEnum.ThreeShotBurst); }
/// <summary> /// Luo pelaaja olion /// </summary> /// <param name="x">Pelaajan x-koordinaatit</param> /// <param name="y">Pelaajan y-koordinaatit</param> /// <returns></returns> PhysicsObject LuoPelaaja(double x, double y) { PhysicsObject pelaaja = new PhysicsObject(25.0, 25.0); pelaaja.Shape = Shape.Circle; pelaaja.X = x; pelaaja.Y = y; pelaaja.Restitution = 0.0; pelaaja.CanRotate = false; pelaaja.Tag = "pelaaja"; pelaaja.Image = LoadImage("survivor"); Add(pelaaja, 1); pelaaja.MirrorImage(); AddCollisionHandler <PhysicsObject, Zombi>(pelaaja, ZombiOsuuPelaajaan); pelaajanAse = new AssaultRifle(30, 10); //pelaajanAse.Ammo.Value = 100; // Ammusten määrä pelaajanAse.InfiniteAmmo = true; pelaajanAse.AttackSound = null; pelaajanAse.CanHitOwner = false; pelaajanAse.X = 5; pelaaja.Add(pelaajanAse); return(pelaaja); }
public void TestModdableWeaponConstructor() { AssaultRifle testWeapon = new AssaultRifle(); Assert.AreEqual(testWeapon.barrelInventory.Count, 1); Assert.AreEqual(testWeapon.barrelInventory[testWeapon.CurrentBarrelIndex].damageMultiplier, new Barrel(BarrelEnum.NoBarrel).damageMultiplier); Assert.AreEqual(testWeapon.CurrentBarrelIndex, 0); }
/// <summary> /// Aseen ampumisen parametrit, mm. nopeus,,ammukset. /// </summary> private void AmmuAseella(AssaultRifle avaruusaluksenAse) { avaruusaluksenAse.Shoot(); avaruusaluksenAse.InfiniteAmmo = true; avaruusaluksenAse.Power.DefaultValue = 200; avaruusaluksenAse.AmmoIgnoresGravity = true; avaruusaluksenAse.FireRate = 2.0; }
// Start is called before the first frame update void Start() { pistol = GetComponentInChildren <Pistol>(); shotgun = GetComponentInChildren <Shotgun>(); rifle = GetComponentInChildren <AssaultRifle>(); ReloadStatus(); SelectWeapon(); }
public void TestRemoveSightWithEmptyInventory() { AssaultRifle testWeapon = new AssaultRifle(); //remove Sight returns false when the inventory is empty var removeSightResult = testWeapon.RemoveSight(); Assert.IsFalse(removeSightResult); }
public void TestFullAuto() { AssaultRifle testWeapon = new AssaultRifle(FireModeEnum.FullAuto); Enemy testEnemy = new Grunt(); testWeapon.Shoot(testEnemy); int test = Grunt.Grunt_Starting_Energy - testWeapon.GetDamage(); Assert.AreEqual(test, testEnemy.EnergyRemaining); }
public void TestToggleSightsWithOneSight() { AssaultRifle testWeapon = new AssaultRifle(); testWeapon.AddSight(SightEnum.LaserSight); var toggleSightResult = testWeapon.ToggleSight(); Assert.IsFalse(toggleSightResult); }
public void TestAddingSingularSight() { AssaultRifle testWeapon = new AssaultRifle(); testWeapon.AddSight(SightEnum.ReflexSight); var expectedSight = testWeapon.GetCurrentSight(); Assert.AreEqual(expectedSight.accuracyMultiplier, new Sight(SightEnum.ReflexSight).accuracyMultiplier); }
public void TestAddingSingularBarrel() { AssaultRifle testWeapon = new AssaultRifle(); testWeapon.AddBarrel(BarrelEnum.LongBarrel); var expectedBarrel = testWeapon.GetCurrentBarrel(); Assert.AreEqual(expectedBarrel.damageMultiplier, new Barrel(BarrelEnum.LongBarrel).damageMultiplier); }
public void TestToggleBarrelsWithOneBarrel() { AssaultRifle testWeapon = new AssaultRifle(); testWeapon.AddBarrel(BarrelEnum.LongBarrel); var toggleBarrelResult = testWeapon.ToggleBarrel(); Assert.IsFalse(toggleBarrelResult); }
private void OnTriggerEnter(Collider other) { AssaultRifle Rifle = rifle.GetComponent <AssaultRifle>(); if (other.CompareTag("Player") && isTriggerPickup && Rifle.currentRifleAmmo != Rifle.maxRifleAmmo) { TakeAmmo(); AudioSource.PlayClipAtPoint(pickup, transform.position, volume); } }
void AmmuAseella(AssaultRifle ase) { PhysicsObject ammus = ase.Shoot(); if (ammus != null) { ammus.Size *= 1.5; ammus.Image = kananmuna; ammus.MaximumLifetime = TimeSpan.FromSeconds(8.0); } }
void AmmuAseella(AssaultRifle ase) { PhysicsObject ammus = ase.Shoot(); if (ammus != null) { ammus.Size *= 0.3; //ammus.Image = ... ammus.MaximumLifetime = TimeSpan.FromSeconds(5.0); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { // get the weapons of the player, even if they are inactive Pistol pistol = player.GetComponentInChildren(typeof(Pistol), true) as Pistol; AssaultRifle rifle = player.GetComponentInChildren(typeof(AssaultRifle), true) as AssaultRifle; Shotgun shotgun = player.GetComponentInChildren(typeof(Shotgun), true) as Shotgun; if (ammoSprite == sprites[0]) { WeaponAmmo ammo = pistol.GetComponent <WeaponAmmo>(); if (ammo.currentReserveAmmo != ammo.maxReserveAmmo) { pickUpSound.Play(); ammo.currentReserveAmmo = ammo.currentReserveAmmo + (ammoMultiplier * ammo.maxMag); if (ammo.currentReserveAmmo > ammo.maxReserveAmmo) { ammo.currentReserveAmmo = ammo.maxReserveAmmo; } StartCoroutine(DeleteObject()); } } else if (ammoSprite == sprites[1]) { WeaponAmmo ammo = rifle.GetComponent <WeaponAmmo>(); if (ammo.currentReserveAmmo != ammo.maxReserveAmmo) { pickUpSound.Play(); ammo.currentReserveAmmo = ammo.currentReserveAmmo + (ammoMultiplier * ammo.maxMag); if (ammo.currentReserveAmmo > ammo.maxReserveAmmo) { ammo.currentReserveAmmo = ammo.maxReserveAmmo; } StartCoroutine(DeleteObject()); } } else if (ammoSprite == sprites[2]) { WeaponAmmo ammo = shotgun.GetComponent <WeaponAmmo>(); if (ammo.currentReserveAmmo != ammo.maxReserveAmmo) { pickUpSound.Play(); ammo.currentReserveAmmo = ammo.currentReserveAmmo + (ammoMultiplier * ammo.maxMag); if (ammo.currentReserveAmmo > ammo.maxReserveAmmo) { ammo.currentReserveAmmo = ammo.maxReserveAmmo; } StartCoroutine(DeleteObject()); } } } }
void TakeAmmo() { AssaultRifle Rifle = rifle.GetComponent <AssaultRifle>(); Rifle.currentRifleAmmo += quantity; if (Rifle.currentRifleAmmo > Rifle.maxRifleAmmo) { Rifle.currentRifleAmmo = Rifle.maxRifleAmmo; } Rifle.SetUI(); Destroy(gameObject); }
public void TestShootAssaultRifleWithAmmo() { AssaultRifle testWeapon = new AssaultRifle(); Enemy testEnemy = new Grunt(); testWeapon.Shoot(testEnemy); int ExpectedGruntHealth = Grunt.Grunt_Starting_Energy - AssaultRifle.Assault_Rifle_Damage_Points; int ActualGruntHealth = testEnemy.EnergyRemaining; Assert.AreEqual(ExpectedGruntHealth, ActualGruntHealth); }
public void TestToggleCyclesToBeginningOfSightCollection() { AssaultRifle testWeapon = new AssaultRifle(); var numToggles = 1; SightEnum[] SightEnumArray = { SightEnum.ZoomSight, SightEnum.LaserSight, SightEnum.ReflexSight }; AddSightsAndToggle(testWeapon, numToggles, ToggleEnum.toggleForwards, SightEnumArray); var actualCurrentSightIndex = testWeapon.CurrentSightIndex; var expectedIndex = ModdableWeapon.StartingSightIndex; Assert.AreEqual(expectedIndex, actualCurrentSightIndex); }
private void LisaaPelaaja(Vector paikka, double leveys, double korkeus) { pelaaja1 = new PlatformCharacter(leveys, korkeus); pelaaja1.Position = paikka; pelaaja1.Mass = 4.0; pelaaja1.Image = pelaajanKuva; AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); Add(pelaaja1); AssaultRifle a = new AssaultRifle(50, 10); pelaaja1.Weapon = a; }
public void TestToggleCyclesToBeginningOfBarrelCollection() { AssaultRifle testWeapon = new AssaultRifle(); var numToggles = 1; BarrelEnum[] barrelEnumArray = { BarrelEnum.ShortBarrel, BarrelEnum.LongBarrel, BarrelEnum.MediumBarrel }; AddBarrelsAndToggle(testWeapon, numToggles, ToggleEnum.toggleForwards, barrelEnumArray); var actualCurrentbarrelIndex = testWeapon.CurrentBarrelIndex; var expectedIndex = ModdableWeapon.StartingBarrelIndex; Assert.AreEqual(expectedIndex, actualCurrentbarrelIndex); }
/// <summary> /// Hoidellaan aseella ampuminen /// </summary> /// <param name="ase">Pelaajan ase</param> public void AmmuAseella(AssaultRifle ase) { PhysicsObject ammus = ase.Shoot(); if (ammus != null) { ammus.Size *= 0.5; AddCollisionHandler <PhysicsObject, Zombi>(ammus, "zombi", AmmusOsuiZombiin); AddCollisionHandler(ammus, "seina", AmmusOsuiSeinaan); AddCollisionHandler(ammus, "reuna", AmmusOsuiSeinaan); ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); } }
public void TestToggleCyclesToEndOfBarrelCollection() { AssaultRifle testWeapon = new AssaultRifle(); BarrelEnum[] barrelEnumArray = { BarrelEnum.ShortBarrel, BarrelEnum.LongBarrel, BarrelEnum.MediumBarrel }; AddBarrelsAndToggle(testWeapon, barrelEnumArray.Length, ToggleEnum.toggleBackwards, barrelEnumArray); var actualCurrentbarrelIndex = testWeapon.CurrentBarrelIndex; var expectedIndex = barrelEnumArray.Length; Assert.AreEqual(expectedIndex, actualCurrentbarrelIndex); }
public void TestToggleCyclesToEndOfSightCollection() { AssaultRifle testWeapon = new AssaultRifle(); SightEnum[] SightEnumArray = { SightEnum.ZoomSight, SightEnum.LaserSight, SightEnum.ReflexSight }; AddSightsAndToggle(testWeapon, SightEnumArray.Length, ToggleEnum.toggleBackwards, SightEnumArray); var actualCurrentSightIndex = testWeapon.CurrentSightIndex; var expectedIndex = SightEnumArray.Length; Assert.AreEqual(expectedIndex, actualCurrentSightIndex); }
public Pickupable GetPickupable() { int num = GameState.GetInstance().Random.Next(8); Weapon spawn; switch (num) { case 0: spawn = new Minigun(GameApplication.GetInstance().mediator); break; case 1: spawn = new SniperRifle(GameApplication.GetInstance().mediator); break; case 2: spawn = new Flamethrower(GameApplication.GetInstance().mediator); break; case 3: spawn = new Shotgun(GameApplication.GetInstance().mediator); break; // Weapons with laser case 4: spawn = new SniperRifle(GameApplication.GetInstance().mediator); new RedLaser(spawn, GameApplication.GetInstance().mediator); break; case 5: spawn = new AssaultRifle(GameApplication.GetInstance().mediator); new RedLaser(spawn, GameApplication.GetInstance().mediator); break; case 6: spawn = new SniperRifle(GameApplication.GetInstance().mediator); new GreenLaser(spawn, GameApplication.GetInstance().mediator); break; case 7: spawn = new AssaultRifle(GameApplication.GetInstance().mediator); new GreenLaser(spawn, GameApplication.GetInstance().mediator); break; default: spawn = new AssaultRifle(GameApplication.GetInstance().mediator); break; } return(spawn); }
public void BuyAR() { if (PlayerModel.Coins < arPrice || isARBought) { return; } var gameObject = new GameObject(); AssaultRifle ar = gameObject.AddComponent <AssaultRifle>(); ar.Unlock(); isARBought = true; PlayerModel.ChangeNumberOfCoins(-arPrice); }
public void TestShootAuxiliaryFireWithAmmo() { AssaultRifle testWeapon = new AssaultRifle(); Enemy testEnemy = new Grunt(); testWeapon.AddAuxiliaryAttachment(); testWeapon.Toggle(); testWeapon.Shoot(testEnemy); int ExpectedGruntHealth = Grunt.Grunt_Starting_Energy - AuxiliaryFire.Auxiliary_Fire_Damage_Points; int ActualGruntHealth = testEnemy.EnergyRemaining; Assert.AreEqual(ExpectedGruntHealth, ActualGruntHealth); }
public override void Begin() { Steve = new PhysicsObject(20, 20); Steve.Restitution = 1.0; pelaajanase = new AssaultRifle(0.10, 0.10); pelaajanase.Ammo.Value = 10; pelaajanase.ProjectileCollision = AmmusOsui; Steve.Add(pelaajanase); AddCollisionHandler(Steve, SteveTormaa); SmoothTextures = false; MediaPlayer.Play("Dark Music - The Sealed Kingdom"); Steve.Image = SteveKuva; Add(Steve); Camera.Follow(Steve); Camera.ZoomFactor = 10; Kentta(); //CreateMonster(); Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pelaajanase); PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-200, 0)); Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, new Vector(200, 0)); Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 200)); Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -200)); Keyboard.Listen(Key.D, ButtonState.Released, LiikutaPelaajaa, null, new Vector(0, 0)); Keyboard.Listen(Key.W, ButtonState.Released, LiikutaPelaajaa, null, new Vector(0, 0)); Keyboard.Listen(Key.S, ButtonState.Released, LiikutaPelaajaa, null, new Vector(-0, 0)); Keyboard.Listen(Key.A, ButtonState.Released, LiikutaPelaajaa, null, new Vector(-0, 0)); }
public void ammuAseella(AssaultRifle ase) { ammus = ase.Shoot(); if (ammus != null) { ammus.Size *= 2; ammus.Image = LoadImage("ammo"); ammus.MaximumLifetime = TimeSpan.FromSeconds(3.0); ammus.X = ammus.X - 40; ammus.Y = ammus.Y + 13; ammus.IgnoresGravity = true; ammus.Restitution = 0.10; ammus.CollisionIgnoreGroup = 3; Add(ammus, 3); } }
void LuoAseValikko() { // Asevalikko Inventory inventory = new Inventory(); inventory.Y = Screen.Top - 20; Add(inventory); Weapon rynkky = new AssaultRifle(20, 10); Weapon plasma = new PlasmaCannon(20, 10); Weapon kanuuna = new Cannon(20,10); kanuuna.Image = Inventory.ScaleImageDown(kanuuna.Image, 4); inventory.AddItem(rynkky, rynkky.Image); inventory.AddItem(plasma, plasma.Image); inventory.AddItem(kanuuna, kanuuna.Image); inventory.ItemSelected += AseValittu; // Valitse pelin aluksi rynkky inventory.SelectItem(rynkky); }
public override void Begin() { MessageDisplay.Add("tervetuloa"); // TODO: Kirjoita ohjelmakoodisi tähän IsFullScreen = true; Level.Background.Image = taustaKuva; Level.Background.FitToLevel(); Pelaaja = new PhysicsObject(100.0, 100.0); Pelaaja.Shape = Shape.Circle; Pelaaja.Image = LoadImage("pelaaja"); Add(Pelaaja); Pelaaja.Mass = 80; PelaajanAse = new AssaultRifle(20, 5); PelaajanAse.Ammo.Value = 5000000; PelaajanAse.ProjectileCollision = AmmusOsui; Pelaaja.Add(PelaajanAse); PelaajaYlos(); LuoPallo(); LuoKentta(); PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); Keyboard.Listen(Key.Up, ButtonState.Down, PelaajaYlos, "PelaajaMeneeYlos"); Keyboard.Listen(Key.Down, ButtonState.Down, PelaajaAlas, "PelaajaMeneeAlas"); Keyboard.Listen(Key.Left, ButtonState.Down, PelaajaVasemmalle, "PelaajaMeneevasemmalle"); Keyboard.Listen(Key.Right, ButtonState.Down, PelaajaOikealle, "PelaajaMeneeOikealle"); Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "ammu"); Camera.ZoomToLevel(); AddCollisionHandler(Pelaaja, PelaajaTormaa); }
void LuoPelaaja(Vector paikka, double korkeus, double leveys) { Steve = new PlatformCharacter(15, 30); Steve.Position = paikka; pelaajanase = new AssaultRifle(15, 5); Steve.Image = SteveKuva; pelaajanase.ProjectileCollision = AmmusOsui; //Steve.Add(pelaajanase) Steve.Weapon = pelaajanase; AddCollisionHandler(Steve, "Monsteri", TormaaMonsteriin); Steve.Animation = new Animation(ukkelinKavely); Add(Steve); Camera.Follow(Steve); Camera.ZoomFactor = 2; }
void luoPelaaja(Vector paikka, double leveys, double korkeus) { pelaaja.Image = pelaajanKuva; pelaaja.CanRotate = false; pelaaja.Restitution = 0; pelaaja.IgnoresCollisionResponse = true; pelaaja.Position = paikka; pelaaja.Brain = mustaAukkoAivot; pelaajanAse = new AssaultRifle(0.01, 0.01); pelaajanAse.AttackSound = aseenAani; pelaajanAse.ProjectileCollision = AmmusOsui; pelaaja.Add(pelaajanAse); Add(pelaaja); }
void ammu(AssaultRifle ase) { PhysicsObject ammus = new PhysicsObject(10, 10); ammus = ase.Shoot(); //ammus.IgnoresCollisionWith(normalBullet1); pelaaja.IgnoresCollisionResponse = true; if (ammus != null) { Add(ammus); ammus.IgnoresCollisionResponse = true; blackHole2.IgnoresCollisionWith(ammus); blackHole1.IgnoresCollisionWith(ammus); laser2.IgnoresCollisionWith(ammus); laser1.IgnoresCollisionWith(ammus); homingBullet.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(homingBullet); normalBullet1.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet1); normalBullet2.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet2); normalBullet3.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet3); normalBullet4.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet4); normalBullet5.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet5); normalBullet6.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet6); normalBullet7.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet7); normalBullet8.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet8); normalBullet9.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet9); normalBullet10.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet10); normalBullet11.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet11); normalBullet12.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet12); normalBullet13.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet13); normalBullet14.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet14); normalBullet15.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet15); normalBullet16.IgnoresCollisionWith(ammus); ammus.IgnoresCollisionWith(normalBullet16); } }
PlatformCharacter Pelaaja1() { pelaaja = new PlatformCharacter(20, 20); Add(pelaaja); pelaaja.Tag = "pelaaja"; Keyboard.Listen(Key.Left, ButtonState.Down, pelaaja.Move, null, new Vector(-1000, 0)); Keyboard.Listen(Key.Right, ButtonState.Down, pelaaja.Move, null, new Vector(1000, 0)); Keyboard.Listen(Key.Down, ButtonState.Down, pelaaja.Push, null, new Vector(0, -1000)); Keyboard.Listen(Key.Up, ButtonState.Down, pelaaja.Push, null, new Vector(0, 1000)); Keyboard.Listen(Key.Up, ButtonState.Released, pelaaja.Stop, null); Keyboard.Listen(Key.Right, ButtonState.Released, pelaaja.Stop, null); Keyboard.Listen(Key.Down, ButtonState.Released, pelaaja.Stop, null); Keyboard.Listen(Key.Left, ButtonState.Released, pelaaja.Stop, null); pelaajan1Ase = new AssaultRifle(30, 10); pelaajan1Ase.Ammo.Value = 1000; pelaajan1Ase.Angle += Angle.FromDegrees(1); pelaaja.Add(pelaajan1Ase); pelaaja.Weapon = pelaajan1Ase; //AssaultRifle pyssy = new AssaultRifle(20, 5); return pelaaja; }
void AmmuAseella(AssaultRifle ase) { PhysicsObject ammus = ase.Shoot(); if (ammus != null) ; ammus.Size *= 0.1; //ammus.Image = ... ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); }
void Luovihollinen(Vector paikka, double leveys, double korkeus) { //PhysicsObject vihollinen = new PhysicsObject(leveys, korkeus); PlatformCharacter vihollinen = new PlatformCharacter(leveys, korkeus); Vector kentanPiste = Level.GetRandomPosition(); vihollinen.Position = kentanPiste; vihollinen.Shape = Shape.Rectangle; vihollinen.Color = Color.Red; vihollinen.Image = päävihollinen; //RandomMoverBrain satunnaisAivot = new RandomMoverBrain(200); //vihollinen.Brain = satunnaisAivot; FollowerBrain seuraajanAivot = new FollowerBrain("pelaaja"); vihollinen.Brain = seuraajanAivot; seuraajanAivot.DistanceClose = 100; vihollinen.CanRotate = false; //seuraajanAivot.TurnWhileMoving = true; vihollisenase = new AssaultRifle(30, 10); vihollinen.Weapon = vihollisenase; vihollisenase.ProjectileCollision = AmmusOsui; vihollinen.Weapon.Ammo.Value = 1000; seuraajanAivot.TargetClose += mitatapahtuukunollaanlahella; //vihollinen.Add(vihollisenase); Add(vihollinen); }
public void BountyHunter() { PlatformCharacter bountyhunter = new PlatformCharacter(100, 200); bountyhunter.Image = LoadImage("bountyhunter"); bountyhunter.X = Level.Bottom + 800; bountyhunter.Y = Level.Left + 370; FollowerBrain vihuRandom = new FollowerBrain(ukko); vihuRandom.Speed = 300; vihuRandom.DistanceFar = 600; vihuRandom.DistanceClose = 200; vihuRandom.StopWhenTargetClose = true; bountyhunter.AnimWalk = new Animation(walkAnim); bountyhunter.AnimWalk.FPS = 6; bountyhunter.Brain = vihuRandom; RandomMoverBrain satunnaisAivot = new RandomMoverBrain(200); satunnaisAivot.ChangeMovementSeconds = 5; vihuRandom.FarBrain = satunnaisAivot; vihunase = new AssaultRifle(100, 50); vihunase.InfiniteAmmo = true; vihunase.FireRate = 0.5; bountyhunter.Weapon = vihunase; vihunase.X = +70; vihunase.Y = +10; vihunase.ProjectileCollision = AmmusOsui; bountyhunter.CollisionIgnoreGroup = 2; Add(bountyhunter, 1); }
public void LisaaUkko() { ukko = new PlatformCharacter(128, 146); ukko.X = Level.Left + 700; ukko.Y = Level.Bottom + 370; ukko.AnimWalk = new Animation (ukonKavely); ukonase = new AssaultRifle(100, 50); ukonase.InfiniteAmmo = true; ukonase.FireRate = 5.0; ukko.Weapon = ukonase; ukonase.X = +70; ukonase.Y = +10; ukonase.Image = LoadImage("assaultrifle"); ukonase.ProjectileCollision = AmmusOsui; ukko.CanRotate = false; ukko.IgnoresGravity = false; ukko.CollisionIgnoreGroup = 1; Add(ukko, 1); lentoPäättyy(); }