private void SetBuildingsToAttack(int x, int z, SpatialIndex spatialIndex)
        {
            Board <Entity>          board    = Service.Get <BoardController>().Board;
            BoardCell <Entity>      cellAt   = board.GetCellAt(x, z, true);
            NodeList <BuildingNode> nodeList = Service.Get <EntityController>().GetNodeList <BuildingNode>();

            spatialIndex.AlreadyScannedBuildingsToAttack = true;
            for (BuildingNode buildingNode = nodeList.Head; buildingNode != null; buildingNode = buildingNode.Next)
            {
                SmartEntity smartEntity = (SmartEntity)buildingNode.Entity;
                if (smartEntity.DamageableComp != null && this.IsAliveHealthNode(smartEntity))
                {
                    int squaredDistance = this.CalcSquredDistanceFromTransformToCell(smartEntity.TransformComp, cellAt);
                    int nearness        = this.CalcNearness(squaredDistance);
                    spatialIndex.AddBuildingsToAttack(smartEntity, nearness);
                }
            }
        }