public virtual void AddGameObject(AbstractGameObject gameObject) { foreach (var figure in gameObject.Figures) { _canvas.AddFigure(figure); } if (gameObject is IProcessable) { _gameObjectsByPriority[(gameObject as IProcessable).Proirity].Add(gameObject); } else { _gameObjectsByPriority[0].Add(gameObject); } }
private static void ReadAndAddFigure(AbstractCanvas canvas, Dictionary <string, AbstractFigure> figuresByName) { var figureType = ReadFigureType(); var figureCreater = AbstractFigureCreateHelper.GetFigureCreateHelper(figureType); var figureName = ReadFigureNameForCreate(figuresByName.Keys.ToArray()); bool contourOnly = false; if (figureCreater.AskContourOnly) { contourOnly = ReadContourOnly(); } var figure = figureCreater.ReadAndCreate(_userName, contourOnly); canvas.AddFigure(figure); figuresByName.Add(figureName, figure); Console.WriteLine("Фигура добавлена. Отобразите холст, чтобы увидеть изменения."); }