示例#1
0
        public SimulationCell FullClone()
        {
            var ret = new SimulationCell();

            foreach (var l in this)
            {
                ret.AddLine((StandardLine)l.Clone());
            }
            return(ret);
        }
示例#2
0
        private void Register(StandardLine l, int x, int y)
        {
            var            key = GetCellKey(x, y);
            SimulationCell cell;

            if (!Cells.TryGetValue(key, out cell))
            {
                cell       = new SimulationCell();
                Cells[key] = cell;
            }
            cell.AddLine(l);
        }
示例#3
0
        private SimulationCell GetPairs(StandardLine input)
        {
            var list  = new SimulationCell();
            var c1    = _editorcells.GetCellFromPoint(input.Position);
            var c2    = _editorcells.GetCellFromPoint(input.Position2);
            var cells = new LineContainer <GameLine>[]
            {
                c1,
                c1 == c2 ? null : c2
            };

            foreach (var cell in cells)
            {
                if (cell == null)
                {
                    continue;
                }
                foreach (var line in cell)
                {
                    if (line.Type == LineType.Scenery)
                    {
                        continue;
                    }
                    if (line.ID != input.ID)
                    {
                        if (
                            line.End == input.Start ||
                            line.Start == input.End)
                        {
                            list.AddLine((StandardLine)line);
                        }
                    }
                }
            }
            return(list);
        }