コード例 #1
0
        void FindLOS(Tile From, Tile To, bool Dither)
        {
            var los = FindLOS(From.Map, From.HexCoordinate, To.HexCoordinate, Dither);

            if (los == null)
            {
                return;
            }

            _LineOfSight  = los;
            _CrossedEdges = new TileComponentRules[_LineOfSight.Length - 1];
            for (int i = 0; i < _LineOfSight.Length - 1; ++i)
            {
                _CrossedEdges[i] = _LineOfSight[i].GetEdgeRules(_LineOfSight[i + 1]);
            }
            _Validated = Verify(_LineOfSight, _CrossedEdges);
        }
コード例 #2
0
        public LineOfSight(Tile From, Tile To)
        {
            if (From == To)
            {
                _LineOfSight  = new Tile[] { From };
                _CrossedEdges = new TileComponentRules[0];
                _Validated    = NoLineOfSightReason.NONE;
                return;
            }

            FindLOS(From, To, false);
            if (_Validated == NoLineOfSightReason.NONE)
            {
                FindLOS(From, To, true);
            }
            if (_LineOfSight == null)
            {
                _Validated = NoLineOfSightReason.TERRAIN;
            }
        }