public void AddUnit(int Col, int Row, int unitType, NATIONALITY nationality)
        {
            _units.Add(Col, Row, unitType, nationality);

            if (nationality == NATIONALITY.USA)
            {
                var newUnit = _units.FindUnit(Col, Row);
                _terrainMap.UnmaskBoard(Col, Row, newUnit.ViewRange);
                _terrainMap.SetView(Col, Row, newUnit.ViewRange);
            }
        }
Example #2
0
        /// <summary>
        /// recompute the views of the entire board
        /// </summary>
        public void RecomputeView()
        {
            // first, reset all the views
            foreach (long key in _terrainMap.Keys)
            {
                _terrainMap[key].View = false;
            }

            // uncover only the allied _units
            foreach (var unit in _units)
            {
                if (unit.Nationality == NATIONALITY.USA)
                {
                    _terrainMap.SetView(unit.Col, unit.Row, unit.ViewRange);
                }
            }
        }