public static void PlaySound3D(SoundDefinition sound, BaseVob vob, float range = 3000, float volume = 1.0f) { if (sound == null) { throw new ArgumentNullException("Sound is null!"); } if (vob == null) { throw new ArgumentNullException("Vob is null!"); } if (!CanPlay(sound)) // don't play too many sounds at once { return; } Logger.Log("PlayVobSound: " + sound.Name); var param = zTSound3DParams.Create(); param.Volume = volume; param.Radius = range; param.Reverb = 0.15f; param.IsAmbient = true; int idPtr = Process.Alloc(4).ToInt32(); Process.Write(idPtr, zCSndSys_MSS.PlaySound3D(sound.zSFX, vob.gVob, 0, param)); vobSounds.Add(new ActiveSound(idPtr, param, sound)); }
public void SetGuideCommand(GuideCmd cmd) { if (this.currentCmd == cmd) { return; } if (this.currentCmd is TargetCmd) { BaseVob target = ((TargetCmd)this.currentCmd).Target; target.OnDespawn -= OnTargetDespawn; if (this.guide != null) { this.guide.RemoveGuideTarget(target); } } if (cmd is TargetCmd) { BaseVob target = ((TargetCmd)cmd).Target; target.OnDespawn += OnTargetDespawn; if (this.guide != null) { this.guide.AddGuideTarget(target); } } if (this.guide != null) { Messages.WriteGuidableCmd(this.guide, this, cmd); } this.currentCmd = cmd; }
internal void RemoveVisibleVob(BaseVob vob) { visibleVobs.Remove(vob.ID); if (guideTargets.ContainsKey(vob.ID)) { vob.targetOf.Add(this); } }
public BaseVobInst() { this.baseInst = CreateVob(); if (this.baseInst == null) { throw new NullReferenceException("BaseInst is null!"); } pConstruct(); }
static void CheckSpawn(BaseVob vob, World world, Vec3f pos, Angles ang) { if (Commands.TryGetValue(vob.ID, out List <TargetCmd> cmdList)) { for (int i = 0; i < cmdList.Count; i++) { cmdList[i].target = vob; } } }
static void CheckDespawn(BaseVob vob) { if (Commands.TryGetValue(vob.ID, out List <TargetCmd> cmdList)) { for (int i = 0; i < cmdList.Count; i++) { cmdList[i].sentDest = vob.Position; cmdList[i].target = null; } } }
internal void RemoveGuideTarget(BaseVob vob) { if (guideTargets.TryGetValue(vob.ID, out IntBox box)) { box.Count--; if (box.Count == 0) { guideTargets.Remove(vob.ID); vob.targetOf.Remove(this); } } }
public override void Stop(GuidedVob vob) { if (Commands.TryGetValue(targetID, out List <TargetCmd> cmdList)) { cmdList.Remove(this); if (cmdList.Count == 0) { Commands.Remove(targetID); } } this.target = null; }
void Vob_OnSpawn(BaseVob vob, World world, Vec3f pos, Angles ang) { if (vob is NPC) { var gVob = ((NPC)vob).gVob; if (gVob != null && overlays != null) { for (int i = 0; i < overlays.Count; i++) { gVob.ApplyOverlay(overlays[i].Name); } } } }
public TargetCmd(BaseVob target, float distance) { if (target == null) { throw new ArgumentNullException("Target is null!"); } if (!target.IsSpawned) { throw new ArgumentException("Target is not spawned!"); } this.target = target; this.distance = distance; }
internal void AddGuideTarget(BaseVob vob) { if (guideTargets.TryGetValue(vob.ID, out IntBox box)) { box.Count++; } else { guideTargets.Add(vob.ID, new IntBox()); if (!visibleVobs.Contains(vob.ID)) { vob.targetOf.Add(this); } } }
void OnTargetDespawn(BaseVob vob) { RemoveGuideCommand(); }
public void RemoveDynVob(BaseVob vob) { dynVobs.Remove(ref vob.CellID); }
public void AddDynVob(BaseVob vob) { dynVobs.Add(vob, ref vob.CellID); }
internal void AddVisibleVob(BaseVob vob) { visibleVobs.Add(vob); vob.targetOf.Remove(this); }
public TargetCmd GetTestCmd(BaseVob target) { return(null); }