public void KillHulk(Collideable hulk) { Vector3 randVec = new Vector3( Helpers.randFloat(-3, 3), Helpers.randFloat(-3, 3), Helpers.randFloat(-3, 3)); if (hulk.modelMesh == ModelType.debrisAsteroid01 || hulk.modelMesh == ModelType.debrisAsteroid02) { FrameworkCore.debrisManager.AddHulkDebris(hulk.Position, true); } else { FrameworkCore.debrisManager.AddHulkDebris(hulk.Position, false); } FrameworkCore.Particles.CreateNova(hulk.Position, randVec); //Helpers.SetRumbleExplosion(); FrameworkCore.audiomanager.Play3DCue(sounds.Explosion.tiny, hulk.audioEmitter); hulks.Remove(hulk); FrameworkCore.playbackSystem.KillItem(hulk); }
public override void Hit(Collideable ship, Vector3 intersectPoint) { //If I am an asteroid, then don't react. if (this.modelMesh == ModelType.debrisAsteroid01 || this.modelMesh == ModelType.debrisAsteroid02) { return; } //hulk chunks do not collide with other hulk chunks. if ((this.modelMesh == ModelType.debrisHulk1 || this.modelMesh == ModelType.debrisHulk2) && (ship.modelMesh == ModelType.debrisHulk1 || ship.modelMesh == ModelType.debrisHulk2)) { return; } //if a ship runs into me, don't react. if (Helpers.IsSpaceship(ship)) { return; } //destroy the hulk. FrameworkCore.hulkManager.KillHulk(this); }
public override void beamHit(Collideable killer, Vector3 hitPos, int minDmg, int maxDmg, Vector3 muzzleVec) { //beams evaporate all rubble. FrameworkCore.hulkManager.KillHulk(this); }
private void BeamDamageCheck(GameTime gameTime) { if (turretWeapon.firetype != Weapon.fireType.Beam) { return; } if (!turretWeapon.beamIsFiring()) { return; } if (turretWeapon.curBeamDamageTime > 0) { turretWeapon.curBeamDamageTime -= (int)gameTime.ElapsedGameTime.TotalMilliseconds; return; } int rayLength = turretWeapon.beamRange; turretWeapon.curBeamDamageTime = turretWeapon.beamDamageTime; Matrix turretOrientation = Matrix.CreateFromQuaternion(rotateQuat); //now let's check if the beam damaged any of the ships. for (int k = 0; k < FrameworkCore.level.Ships.Count; k++) { Collideable ship = FrameworkCore.level.Ships[k]; //don't hit myself. if (ship == parentShip) { continue; } //don't hit destroyed ships. if (ship.IsDestroyed) { continue; } //no friendly fire. if (ship.owner != null && ship.owner.factionName == parentShip.owner.factionName) { continue; } for (int i = 0; i < muzzleOffsets.Length; i++) { Vector3 muzzleVec = position; muzzleVec += (turretOrientation.Right * muzzleOffsets[i].X) + (turretOrientation.Up * muzzleOffsets[i].Y) + (turretOrientation.Forward * -muzzleOffsets[i].Z); Vector3 finalPredictedPosition = muzzleVec + turretOrientation.Forward * 128; Vector3 rayDir = finalPredictedPosition - muzzleVec; rayDir.Normalize(); Ray beamRay = new Ray(muzzleVec, rayDir); if (ship.CollisionSpheres.Length > 1) { //if this is a multi-sphere ship, then first do a //preliminary check on the ship's all-encompassing bSphere. //if it comes false, then skip doing the detailed check. if (ship.BSphere.Intersects(beamRay) > rayLength) { continue; } } for (int m = 0; m < ship.CollisionSpheres.Length; m++) { if (ship.CollisionSpheres[m].sphere.Intersects(beamRay) <= rayLength) { ship.beamHit(parentShip, ship.CollisionSpheres[m].sphere.Center, turretWeapon.beamMinDamage, turretWeapon.beamMaxDamage, muzzleVec); break; } } } } }
public virtual void beamHit(Collideable killer, Vector3 hitPos, int minDmg, int maxDmg, Vector3 muzzleVec) { }
public virtual void Hit(Collideable ship, Vector3 intersectPoint) { }