コード例 #1
0
ファイル: Shroud.cs プロジェクト: hadow/Commander
        public void Explore(Shroud shroud)
        {
            if (map.Bounds != shroud.map.Bounds)
            {
                throw new ArgumentException("The map bounds of  these shrouds do not match.");
            }

            var changed = new List <PPos>();

            foreach (var puv in map.ProjectedCellBounds)
            {
                var uv = (MPos)puv;
                if (!explored[uv] && shroud.explored[uv])
                {
                    explored[uv] = true;
                    changed.Add(puv);
                }
            }

            Invalidate(changed);
        }
コード例 #2
0
        public FrozenActor(Actor actor, PPos[] footprint, Player viewer, bool startsRevealed)
        {
            this.actor  = actor;
            this.viewer = viewer;

            shroud          = viewer.Shroud;
            NeedRenderables = startsRevealed;

            //Consider all cells inside the map are(ignoring the current map bounds)
            Footprint = footprint.Where(m => shroud.Contains(m)).ToArray();

            if (Footprint.Length == 0)
            {
                throw new ArgumentException("The frozen actor has no footprint");
            }

            CenterPosition = actor.CenterPosition;
            TargetTypes    = new HashSet <string>();

            health = actor.TraitOrDefault <IHealth>();

            UpdateVisibility();
        }