public FrozenActor(Actor self, PPos[] footprint, Shroud shroud, bool startsRevealed) { actor = self; this.shroud = shroud; NeedRenderables = startsRevealed; // Consider all cells inside the map area (ignoring the current map bounds) Footprint = footprint .Where(m => shroud.Contains(m)) .ToArray(); if (Footprint.Length == 0) { throw new ArgumentException(("This frozen actor has no footprint.\n" + "Actor Name: {0}\n" + "Actor Location: {1}\n" + "Input footprint: [{2}]\n" + "Input footprint (after shroud.Contains): [{3}]") .F(actor.Info.Name, actor.Location.ToString(), footprint.Select(p => p.ToString()).JoinWith("|"), footprint.Select(p => shroud.Contains(p).ToString()).JoinWith("|"))); } CenterPosition = self.CenterPosition; Bounds = self.Bounds; TargetTypes = self.GetEnabledTargetTypes().ToHashSet(); tooltip = self.TraitsImplementing <ITooltip>().FirstOrDefault(); health = self.TraitOrDefault <IHealth>(); UpdateVisibility(); }
public FrozenActor(Actor actor, ICreatesFrozenActors frozenTrait, PPos[] footprint, Player viewer, bool startsRevealed) { this.actor = actor; this.frozenTrait = frozenTrait; this.viewer = viewer; shroud = viewer.Shroud; NeedRenderables = startsRevealed; // Consider all cells inside the map area (ignoring the current map bounds) Footprint = footprint .Where(m => shroud.Contains(m)) .ToArray(); if (Footprint.Length == 0) { throw new ArgumentException(("This frozen actor has no footprint.\n" + "Actor Name: {0}\n" + "Actor Location: {1}\n" + "Input footprint: [{2}]\n" + "Input footprint (after shroud.Contains): [{3}]") .F(actor.Info.Name, actor.Location.ToString(), footprint.Select(p => p.ToString()).JoinWith("|"), footprint.Select(p => shroud.Contains(p).ToString()).JoinWith("|"))); } CenterPosition = actor.CenterPosition; tooltips = actor.TraitsImplementing <ITooltip>().ToArray(); health = actor.TraitOrDefault <IHealth>(); UpdateVisibility(); }
public FrozenActor(Actor self, MPos[] footprint, Shroud shroud) { actor = self; this.shroud = shroud; // Consider all cells inside the map area (ignoring the current map bounds) Footprint = footprint .Where(m => shroud.Contains(m)) .ToArray(); CenterPosition = self.CenterPosition; Bounds = self.Bounds; UpdateVisibility(); }
public FrozenActor(Actor self, MPos[] footprint, Shroud shroud) { actor = self; this.shroud = shroud; // Consider all cells inside the map area (ignoring the current map bounds) Footprint = footprint .Where(m => shroud.Contains(m)) .ToArray(); CenterPosition = self.CenterPosition; Bounds = self.Bounds; UpdateVisibility(); }
public FrozenActor(Actor self, PPos[] footprint, Shroud shroud, bool startsRevealed) { actor = self; this.shroud = shroud; NeedRenderables = startsRevealed; removeFrozenActors = self.TraitsImplementing <IRemoveFrozenActor>().ToArray(); // Consider all cells inside the map area (ignoring the current map bounds) Footprint = footprint .Where(m => shroud.Contains(m)) .ToArray(); CenterPosition = self.CenterPosition; Bounds = self.Bounds; TargetTypes = self.TraitsImplementing <ITargetable>().Where(Exts.IsTraitEnabled).SelectMany(t => t.TargetTypes).ToHashSet(); UpdateVisibility(); }
public FrozenActor(Actor self, PPos[] footprint, Shroud shroud, bool startsRevealed) { actor = self; this.shroud = shroud; NeedRenderables = startsRevealed; removeFrozenActors = self.TraitsImplementing<IRemoveFrozenActor>().ToArray(); // Consider all cells inside the map area (ignoring the current map bounds) Footprint = footprint .Where(m => shroud.Contains(m)) .ToArray(); CenterPosition = self.CenterPosition; Bounds = self.Bounds; TargetTypes = self.TraitsImplementing<ITargetable>().Where(Exts.IsTraitEnabled).SelectMany(t => t.TargetTypes).ToHashSet(); UpdateVisibility(); }