public virtual void onTick() { //First, need to set what object sare in range //since this is the first ontick method. if (vArray == null) { vArray = Interaction.getObjectsInRange(this, reachRange, Interaction.RangeFlag.existing); } updateTotalDistance(); move(); if (Options.mode == Options.Modes.mission && followTarget && origTarget != null) { z = origTarget.z; } if (damage < 1) { expl = DSound.LoadSound3d(DSound.SoundPath + "\\m4-1.wav"); DSound.PlaySound(expl, true, false); finished = true; } }
public SecondarySoundBuffer loadSound(string filename) { SecondarySoundBuffer s = null; System.Diagnostics.Trace.WriteLine("Loading sound " + filename); if (isAI && !autoPlayTarget) { if (!forceStareo) { s = DSound.LoadSound3d(filename); } else { s = DSound.LoadSound(filename); } } else //Either this is not AI or this is autoPlayTarget { s = DSound.LoadSound(filename); } if (s == null) { System.Diagnostics.Trace.WriteLine(filename + " is a null buffer"); } return(s); }
public override void playCrashSound(int x, int y) { if (crashSound == null) { crashSound = DSound.LoadSound3d(DSound.SoundPath + "\\a_fwall.wav"); } DSound.PlaySound3d(crashSound, true, false, x, y, 0); }
public SAMMissile(Weapons w) : base(w, "p" + (int)WeaponTypes.samMissile) { weapon.decreaseAmmunitionFor(WeaponTypes.samMissile); neutralizeSpeed(3000.0); launch = loadSound(soundPath + "sam1.wav"); moveSound = DSound.LoadSound3d(DSound.SoundPath + "\\bsg2.wav"); setSpan(0.20, 0.20); followTarget = false; }
public Missile(Weapons w) : base(w, "p" + (int)WeaponTypes.missile) { type = WeaponTypes.missile; weapon.decreaseAmmunitionFor(WeaponTypes.missile); missileLaunchSound = loadSound(soundPath + "m1.wav"); missileSound = DSound.LoadSound3d(DSound.SoundPath + "\\m2.wav"); addVolume(missileSound); neutralizeSpeed(1500.0); setSpan(0.1, 0.1); }
public MissileInterceptor(Weapons w) : base(w, "p" + (int)WeaponTypes.cruiseMissile) { type = WeaponTypes.missileInterceptor; weapon.decreaseAmmunitionFor(WeaponTypes.missileInterceptor); neutralizeSpeed(900.0); setSpan(0.10, 0.25); launchSound = loadSound(soundPath + "ci1.wav"); missileSound = DSound.LoadSound3d(DSound.SoundPath + "\\ci2.wav"); addVolume(missileSound); }
public CruiseMissile(Weapons w) : base(w, "p" + (int)WeaponTypes.cruiseMissile) { type = WeaponTypes.cruiseMissile; weapon.decreaseAmmunitionFor(WeaponTypes.cruiseMissile); neutralizeSpeed((weapon.creator.flyingCruiseMissile) ? 1800.0 : 900.0); setSpan(0.10, 0.25); launchSound = loadSound(soundPath + "cr1.wav"); missileSound = DSound.LoadSound3d(DSound.SoundPath + "\\cr2.wav"); addVolume(missileSound); }
public TankMissile(Weapons w) : base(w, "p" + (int)WeaponTypes.tankMissile) { weapon.decreaseAmmunitionFor(WeaponTypes.tankMissile); neutralizeSpeed(100.0); launch = loadSound(soundPath + "tg1.wav"); moveSound = DSound.LoadSound3d(DSound.SoundPath + "\\bsg2.wav"); addVolume(moveSound); setSpan(0.01, 0.01); followTarget = false; }
public ExplosiveMissile(Weapons w) : base(w, "p" + (int)WeaponTypes.explosiveMissile) { weapon.decreaseAmmunitionFor(WeaponTypes.explosiveMissile); missileLaunchSound = loadSound(soundPath + "m1.wav"); missileSound = DSound.LoadSound3d(DSound.SoundPath + "\\m2.wav"); addVolume(missileSound); neutralizeSpeed(1500.0); setSpan(0.1, 0.1); followTarget = false; }
public BattleShipGuns(Weapons w) : base(w, "p" + (int)WeaponTypes.battleShipGuns) { weapon.decreaseAmmunitionFor(WeaponTypes.battleShipGuns); neutralizeSpeed(1000.0); launch = loadSound(soundPath + "bsg1.wav"); moveSound = DSound.LoadSound3d(DSound.SoundPath + "\\bsg2.wav"); setSpan(0.05, 0.10); addVolume(moveSound); followTarget = false; explodes = (Common.getRandom(0, 1) == 0) ? false : true; }
/// <summary> /// Creates a new missile. /// </summary> /// <param name="thrower">The Person throwing the missile.</param> /// <param name="target">The target Person.</param> /// <param name="speed">The number of milliseconds to elapse between each move of the missile.</param> /// <param name="maxDamage">The maximum damage the missile can cause.</param> public PersonMissile(Person thrower, Person target, int speed, int maxDamage) { x = thrower.x; y = thrower.y; this.speed = speed; this.maxDamage = maxDamage; this.target = target; startTime = DateTime.Now; moveSound = DSound.LoadSound3d(DSound.SoundPath + "\\a_mmove.wav"); explodeSound = DSound.LoadSound3d(DSound.SoundPath + "\\a_mexpl.wav"); DSound.PlaySound3d(moveSound, true, true, x, 0, y); }
protected SecondarySoundBuffer loadSound(string filename) { SecondarySoundBuffer s = null; if (isAI) { s = DSound.LoadSound3d(DSound.SoundPath + "\\a_" + filename); } else { s = DSound.LoadSound(DSound.SoundPath + "\\" + filename); } return(s); }
protected void explode() { expl = DSound.LoadSound3d(DSound.SoundPath + "\\m4-1.wav"); playSound3d(expl, true, false); List <Projector> hits = Interaction.getObjectsInRange(this, new Range(2.0, 1000.0), Interaction.RangeFlag.existing); if (hits == null) { return; } foreach (Projector hit in hits) { hit.hit(10, Interaction.Cause.destroyedByWeapon); fireHitEvent(hit, hit.damage); } }
public override void onTick() { if (isFinished()) { fireDisposeEvent(); return; } if (finished && performing) { //The weapon is done doing what it needs to do, but a sound is still playing. //Do not free this weapon until the sound is done playing . performing = (Hit != null && DSound.isPlaying(Hit)) || (expl != null && DSound.isPlaying(expl)); return; } performing = true; base.onTick(); playSound(moveSound, false, false); if (inFiringRange()) { moveSound.Stop(); if (explodes) { Hit = DSound.LoadSound3d(DSound.SoundPath + "\\m4-1.wav"); playSound3d(Hit, true, false); } else { Hit = target.loadSound(target.soundPath + "bsg" + Common.getRandom(3, 4) + ".wav"); target.playSound(Hit, true, false); } fireHitEvent(target, (explodes) ? Common.getRandom(250, 300) : Common.getRandom(201, 250)); finished = true; return; } if (!DSound.isPlaying(moveSound)) { finished = true; explode(); performing = (Hit != null && DSound.isPlaying(Hit)) || (expl != null && DSound.isPlaying(expl)); } }
public SecondarySoundBuffer loadSound(string filename) { SecondarySoundBuffer s = null; if (isAI && !autoPlayTarget) { if (!forceStareo) { s = DSound.LoadSound3d(filename); } else { s = DSound.LoadSound(filename); } } else //Either this is not AI or this is autoPlayTarget { s = DSound.LoadSound(filename); } return(s); }