public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination) { Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel; if (GunTimer.Ready == true) { Game1.sound.Play(1f, (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f); GunTimer.Reset(); Game1.mapLive.MapProjectiles.Add(new Projectile(Damage, rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner)); return(true); } return(false); }
public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination) { Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel; if (Ammo > 0 && GunTimer.Ready == true) { Sound.PlaySoundSimple(Game1.soundVortex, (float)((1f / 2f) + Globals.GlobalRandom.NextDouble() / 2f), (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f); Ammo--; GunTimer.Reset(); Game1.mapLive.MapProjectiles.Add(new EnergyBall(rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner, Damage)); Kick(4); return(true); } return(false); }
public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination) { Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel; if (Ammo > 0 && GunTimer.Ready == true) { Game1.soundFlamb.Play((float)((1f / 2f) + Globals.GlobalRandom.NextDouble() / 2f), (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f); GunTimer.Reset(); Game1.mapLive.MapProjectiles.Add(new FlameProjectile(rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner, 16)); _muzzleAlpha = 1f; Ammo--; return(true); } return(false); }
public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination) { Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel; if (Ammo > 0 && GunTimer.Ready == true) { Ammo--; GunTimer.Reset(); Game1.mapLive.MapProjectiles.Add(new Rocket(rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner, 64)); _muzzleAlpha = 1; Kick(8); return(true); } return(false); }
public void Update(List <Inpc> npcs) { foreach (Inpc npc in npcs) { if (npc != this) { if (CompareF.RectangleFVsCircleF(BoundaryCircle, npc.Boundary) == true) { npc.KineticDamage(25); LineSegmentF temp = new LineSegmentF(BoundaryCircle.Center, npc.Boundary.Origin); npc.Push(temp.NormalizedWithZeroSolution() * 6f); npc.Stun(); PlaySaw(); } } } if (CompareF.RectangleFVsCircleF(BoundaryCircle, Game1.PlayerInstance.Boundary) == true) { Game1.PlayerInstance.TakeDamage(25); LineSegmentF temp = new LineSegmentF(BoundaryCircle.Center, Game1.PlayerInstance.Boundary.Origin); Game1.PlayerInstance.Push(temp.NormalizedWithZeroSolution() * 6f); PlaySaw(); } rotation += Game1.Delta; }
private void fireRay(Vector2 rayStart, Vector2Object RayDestination) { if (RayDestination != null && RayDestination.Vector2 != null) { if (Owner is Player) { _line = new LineSegmentF(rayStart, RayDestination.Vector2); } if (Owner is Inpc) { _line = new LineSegmentF((Owner as Inpc).Boundary.Origin, RayDestination.Vector2); } if (RayDestination.Object != null && RayDestination.Object is Inpc && (RayDestination.Object as Inpc).Friendly == false) { (RayDestination.Object as Inpc).Push(_line.NormalizedWithZeroSolution() * _velocityAdd * 0.5f); (RayDestination.Object as Inpc).Stun(); (RayDestination.Object as Inpc).KineticDamage(Damage); } if (RayDestination.Object != null) { if (RayDestination.Object is Map || RayDestination.Object is Player) { Game1.mapLive.mapParticles.Add(new ParticleLaserDest(RayDestination.Vector2)); } if (RayDestination.Object is IRectanglePhysics) { } } } }
public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination) { if ((Ammo > 0 && GunTimer.Ready == true) || MaxAmmo == 0) { Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel; Game1.soundElectro.Play(1f, (float)(Globals.GlobalRandom.NextDouble()) / 2f, 0f); Ammo--; fireRay(barrel, destination); if (Owner is Player) { for (int i = 0; i < 3; i++) { Game1.mapLive.mapLightings.Add(new Lightning(barrel, destination.Vector2, Game1.Textures["Lightning"], 16, -1)); } for (int i = 0; i < 1; i++) { Game1.mapLive.mapLightings.Add(new Lightning(barrel, destination.Vector2, Game1.Textures["LightningBig"], 16, -1)); } for (int i = 0; i < 1; i++) { Game1.mapLive.mapLightings.Add(new Lightning(barrel, destination.Vector2, Game1.Textures["lightningChain"], 16, -3, 3f)); } } GunTimer.Reset(); return(true); } return(false); }
public static void Explode(Vector2 pos, short damage) { CircleF circle = new CircleF(pos, 128); foreach (IParticle prtcl in Game1.mapLive.mapParticles) { if (prtcl.Boundary != null) { LineSegmentF Temp = new LineSegmentF(pos, prtcl.Boundary.Origin); Vector2?_thru = CompareF.IntersectionLineWithOthers(Temp, Game1.mapLive.TileMapLines, null); if (_thru == null) { prtcl.Push(Vector2.Normalize(Temp.NormalizedWithZeroSolution() * (float)(Globals.GlobalRandom.NextDouble()) * 2)); } } } int j = 0; foreach (Inpc npc in Game1.mapLive.MapNpcs) { if (j < 8) { LineSegmentF Temp = new LineSegmentF(pos, npc.Boundary.Origin); Vector2?_thru = CompareF.IntersectionLineWithOthers(Temp, Game1.mapLive.TileMapLines, null); if (_thru == null && LineSegmentF.Lenght(pos, npc.Boundary.Origin) < 256) { if (npc.Friendly == false) { npc.KineticDamage(damage); } npc.Push(Vector2.Normalize(Temp.NormalizedWithZeroSolution() * (float)(Globals.GlobalRandom.NextDouble()) * 2)); j++; } } } int x = 4; for (int i = 0; i < x; i++) { Game1.mapLive.mapParticles.Add(new ParticleSmokeBig(circle.GenerateRandomPoint())); } for (int i = 0; i < x; i++) { Game1.mapLive.mapParticles.Add(new ParticleFireBig(circle.GenerateRandomPoint())); } for (int i = 0; i < x; i++) { Game1.mapLive.mapParticles.Add(new ParticleFireSmall(circle.GenerateRandomPoint())); } Camera2DGame.Shake(10, pos); Sound.PlaySoundPosition(pos, Game1.soundExplosion, CustomMath.RandomAroundZero(Globals.GlobalRandom) / 2f); }
public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination) { Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel; if (GunTimer.Ready == true) { Sound.PlaySoundSimple(Game1.sound, 1f, (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f); GunTimer.Reset(); Game1.mapLive.MapProjectiles.Add(new Projectile((short)(Damage + OwnerGun.DamagePlus), CompareF.RotateVector2(rayEnlonged.NormalizedWithZeroSolution(), (float)((Globals.GlobalRandom.NextDouble() - 0.5f) * (Dispersion + OwnerGun.DispersionPlus))) * (VelocityOfProjectile + OwnerGun.VelocityOfProjectile), barrel, Owner)); return(true); } return(false); }
private bool fireRay(Vector2 rayStart, Vector2Object RayDestination) { if (RayDestination != null && RayDestination.Vector2 != null) { if (RayDestination.Object != null && RayDestination.Object is Inpc && (RayDestination.Object as Inpc).Friendly == false) { (RayDestination.Object as Inpc).Push(_line.NormalizedWithZeroSolution() * _velocityAdd * 0.1f); (RayDestination.Object as Inpc).Stun(); (RayDestination.Object as Inpc).KineticDamage(Damage); } if (RayDestination.Object != null && (RayDestination.Object is Map || RayDestination.Object is Player)) { Game1.mapLive.mapParticles.Add(new ParticleLaserDest(RayDestination.Vector2)); } return(true); } return(false); }
public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination) { Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel; if (destination != null && destination != null) { if (Owner is Player) { _line = new LineSegmentF(rayEnlonged.Start, destination.Vector2); } if (Owner is Inpc) { _line = new LineSegmentF((Owner as Inpc).Boundary.Origin, destination.Vector2); } } _rotation = rayEnlonged.ToAngle(); if ((Ammo > 0 && GunTimer.Ready == true) || MaxAmmo == 0) { Ammo--; SetOn(); fireRay(barrel, destination); GunTimer.Reset(); if (destination != null && destination != null) { if (Owner is Player) { } if (Owner is Inpc) { //Game1.PlayerIns.Push(LineSegmentF.SegmentToNormalizedVector((Owner as Enemy).Ray) * 0.02f); } } return(true); } return(false); }
private void Walk() { if (StunLeft.Ready == true) { if ((_resolver.TouchTop == true || _resolver.TouchBottomMovable == true) || _resolver.InWater) { if (Goes == ZombieStates.right) { Velocity = new Vector2(_maxSpeed.X, Velocity.Y); } if (Goes == ZombieStates.left) { Velocity = new Vector2(-_maxSpeed.X, Velocity.Y); } } } StrikeTimer.Update(); if (Game1.PlayerInstance.Alive == true) { if (StrikeTimer.Ready == true) { if (CompareF.RectangleFVsRectangleF(Boundary, Game1.PlayerInstance.Boundary) == true) { if (StrikeTimer.Ready == true) { LineSegmentF line = new LineSegmentF(Boundary.Origin, Game1.PlayerInstance.Boundary.Origin); Vector2 velocity = line.NormalizedWithZeroSolution() * 4; Game1.PlayerInstance.Push(new Vector2(velocity.X, velocity.Y / 2)); Game1.PlayerInstance.TakeDamage(10); StrikeTimer.Reset(); } } } } }
public Vector2 BarrelVector2(LineSegmentF ray, int barrelLenght) { return(ray.Start + ray.NormalizedWithZeroSolution() * barrelLenght); }