/// <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; }
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); }
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); } }
void ammuKK() { PhysicsObject ammus = kk.Shoot(); if (ammus != null) { ammus.Velocity = new Vector(ammus.Velocity.X * 1.5, ammus.Velocity.Y * 1.5); ammus.Width = 7; ammus.Height = 7; ammus.Image = pisteKuva; } }
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); }
/// <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 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); }
private void Shoot() { if (_activeWeapon == 0) { _handgun.Shoot(_bulletPrefab, _weapons[0].transform.GetChild(0).gameObject, 0f); } if (_activeWeapon == 1) { _assaultRifle.Shoot(_bulletPrefab, _weapons[1].transform.GetChild(0).gameObject, _assaultRifleShootingFrequency); } if (_activeWeapon == 2) { _grenadeThrower.Shoot(_grenadePrefab, _weapons[2].transform.GetChild(0).gameObject, _grenadeThrowingFrequency); } }
public void TestToggleWhenAuxiliaryFireIsOutOfAmmoAndAssaultRifleIsAvailable() { AssaultRifle testWeapon = new AssaultRifle(); Enemy testEnemy = new Grunt(); testWeapon.AddAuxiliaryAttachment(); testWeapon.Toggle(); testWeapon.auxiliaryFireWeapon.SetAmmo(0); testWeapon.Shoot(testEnemy); int ExpectedGruntHealth = Grunt.Grunt_Starting_Energy - AssaultRifle.Assault_Rifle_Damage_Points; int ActualGruntHealth = testEnemy.EnergyRemaining; Assert.AreEqual(ExpectedGruntHealth, ActualGruntHealth); }
void Update() { moveInput = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical")); moveVelocity = moveInput * movementSpeed; //Rotate with mouse Ray cameraRay = mainCamera.ScreenPointToRay(Input.mousePosition); Plane groundPlane = new Plane(Vector3.up, Vector3.zero); float rayLength; if (groundPlane.Raycast(cameraRay, out rayLength)) { Vector3 pointToLook = cameraRay.GetPoint(rayLength); //Debug.DrawLine(cameraRay.origin, pointToLook, Color.blue); transform.LookAt(new Vector3(pointToLook.x, transform.position.y, pointToLook.z)); } //Rotate with controller Vector3 playerDirection = Vector3.right * Input.GetAxis("RHorizontal") + Vector3.forward * -Input.GetAxis("RVertical"); if (playerDirection.sqrMagnitude > 0.0f) { transform.rotation = Quaternion.LookRotation(playerDirection, Vector3.up); } if (((Input.GetButton("Fire1") || (Input.GetAxis("GamePad_RT") != 0)) && rifle.ammo > 0 && rifle.fireRate <= 0)) { rifle.ammo--; rifle.fireRate = rifle.fireRateStart; rifle.Shoot(); } if (Input.GetButtonDown("Reload")) { StartCoroutine("Reload"); } if (Input.GetButtonDown("FlashBang") && player.grenadeAmount > 0) { ThrowFlashBang(); player.grenadeAmount--; } }
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); } }
private void LuoPelaaja(Vector position, double width, double height) { PlatformCharacter hahmo = new PlatformCharacter(40, 80); hahmo.Position = position; Add(hahmo); AssaultRifle ase = new AssaultRifle(60, 15); hahmo.Weapon = ase; //PlatformCharacter apu = new PlatformCharacter( 20, 20, Shape.Circle ); PhysicsObject apu = new PhysicsObject(20, 20, Shape.Circle); FollowerBrain aivot = new FollowerBrain(hahmo); aivot.DistanceClose = 80; aivot.StopWhenTargetClose = true; apu.Brain = aivot; apu.IgnoresGravity = true; Add(apu); AddCollisionHandler(apu, "ammus", delegate(PhysicsObject a, PhysicsObject b) { a.Destroy(); b.Destroy(); }); Label hahmonNimi = new Label(RandomGen.NextLetter(true).ToString() + RandomGen.NextLetter(false).ToString()); hahmonNimi.Bottom = hahmo.Height; hahmo.Add(hahmonNimi); Keyboard.Listen(Key.Space, ButtonState.Down, delegate { var ammus = ase.Shoot(); if (ammus != null) { ammus.Tag = "ammus"; } }, null); Keyboard.Listen(Key.Right, ButtonState.Down, () => hahmo.Walk(200), null); Keyboard.Listen(Key.Left, ButtonState.Down, () => hahmo.Walk(-200), null); Keyboard.Listen(Key.Up, ButtonState.Down, () => hahmo.Jump(600), null); Keyboard.Listen(Key.Enter, ButtonState.Pressed, delegate { if (!apu.IsDestroyed) { MessageDisplay.Add("boop!"); } }, null); }
/// <summary> /// Torni ampuu viruksia. Kun virus pääsee maaliin, alkaa torni ampua jostain syystä joka toisella yli. /// </summary> /// <param name="kohteet">Mitä ammutaan</param> /// <param name="ase">Millä ammutaan</param> public void TorniAmpuu(List <Virus> kohteet, AssaultRifle ase) { if (kohteet.Count == 0) { return; } Virus kohde = HeikoinLenkki(kohteet, ase.Position); if (kohde == null) { return; } Vector suunta = (kohde.Position + (kohde.Velocity * (Vector.Distance(kohde.Position, ase.Position) / 500)) - ase.AbsolutePosition).Normalize(); ase.Angle = suunta.Angle; PhysicsObject ammus = ase.Shoot(); if (ammus != null) { ammus.IgnoresCollisionResponse = true; } }
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); } }
void Ammu(AssaultRifle rifle, Pelaaja pelaaja) { PhysicsObject ammus = rifle.Shoot(); }
void AmmuAseella(AssaultRifle ase) { PhysicsObject ammus = ase.Shoot(); if (ammus != null) ; ammus.Size *= 0.1; //ammus.Image = ... ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); }