Beispiel #1
0
            public void AddLeft(int dropsCount, FluidSimulation fluidSimulation)
            {
                x      -= dropsCount;
                length += dropsCount;

                // check if the line is now connected to a new line above
                List <FluidLine> aboveLines;

                if (fluidSimulation.TryGetFluidLines(this.y + 1, out aboveLines))
                {
                    foreach (FluidLine aboveLine in aboveLines)
                    {
                        // check if it contains the new x-value
                        if (this.VerticallyConnectedTo(aboveLine))
                        {
                            this.AddAboveLine(aboveLine);
                            aboveLine.AddBelowLine(this);
                        }
                    }
                }

                // check if the line is now connected to a new line below
                List <FluidLine> belowLines;

                if (fluidSimulation.TryGetFluidLines(this.y - 1, out belowLines))
                {
                    foreach (FluidLine belowLine in belowLines)
                    {
                        // check if it contains the new x-value
                        if (this.VerticallyConnectedTo(belowLine))
                        {
                            this.AddBelowLine(belowLine);
                            belowLine.AddAboveLine(this);
                        }
                    }
                }
            }