HelloWorld.JsonDataService.RefreshUnitCahce C# (CSharp) Method

RefreshUnitCahce() private method

private RefreshUnitCahce ( Unit unit ) : void
unit Unit
return void
        private void RefreshUnitCahce( Unit unit )
        {
            lock ( _unitSync )
              {

            HashSet<Unit> set;

            if ( _playerUnits.TryGetValue( unit.Owner, out set ) == false )
              _playerUnits[unit.Owner] = set = new HashSet<Unit>();

            set.Add( unit );

            if ( _placeUnits.TryGetValue( unit.Coordinate, out set ) == false )
              _placeUnits[unit.Coordinate] = set = new HashSet<Unit>();

            set.Add( unit );
              }
        }