public void Initialize()
        {
            lastUpdate     = DateTime.Now;
            lastDraw       = DateTime.Now;
            lastDataUpdate = DateTime.Now;
            Ellipse e;

            for (int i = 0; i < 39; i++)
            {
                for (int j = 0; j < 39; j++)
                {
                    e        = new Ellipse();
                    e.Width  = 15;
                    e.Height = 15;
                    e.Fill   = Brushes.Blue;
                    canvas.Children.Add(e);
                    Canvas.SetLeft(e, (double)i * 15);
                    Canvas.SetTop(e, (double)j * 15);
                    cellArray[i, j]      = new GasCell(e, i * 15, j * 15, cellArray);
                    cellArray[i, j].arrX = i;
                    cellArray[i, j].arrY = j;
                }
            }

            //cellArray[20, 20].nextGasAmount = 10;
        }
示例#2
0
        public void Initialize()
        {
            lastUpdate = DateTime.Now;
            lastDraw = DateTime.Now;
            lastDataUpdate = DateTime.Now;
            Ellipse e;
            for (int i = 0; i < 39; i++)
            {
                for (int j = 0; j < 39; j++)
                {
                    e = new Ellipse();
                    e.Width = 15;
                    e.Height = 15;
                    e.Fill = Brushes.Blue;                    
                    canvas.Children.Add(e);
                    Canvas.SetLeft(e, (double)i * 15);
                    Canvas.SetTop(e, (double)j * 15);
                    cellArray[i, j] = new GasCell(e, i*15, j*15, cellArray);
                    cellArray[i, j].arrX = i;
                    cellArray[i, j].arrY = j;
                }
            }

            //cellArray[20, 20].nextGasAmount = 10;
        }
示例#3
0
 public GasCell(Ellipse e, double _x, double _y, GasCell[,] _cellArray)
 {
     attachedellipse = e;
     x = _x;
     y = _y;
     SetGasDisplay();
     cellArray = _cellArray;
     GasVel = new Vector2(0, 0);
     NextGasVel = new Vector2(0, 0);
 }
        private void MouseDownEventHandler(object sender, MouseEventArgs e)
        {
            double addamount = 100;
            Point  p         = e.GetPosition(this);

            p.X -= 7.5;
            p.Y -= 7.5;
            GasCell g = GetCellAtPoint(p);

            if (g == null)
            {
                return;
            }
            if (e.LeftButton == MouseButtonState.Pressed && Keyboard.IsKeyDown(Key.LeftShift))
            {
                g.sink = !g.sink;
            }
            else if (e.RightButton == MouseButtonState.Pressed && Keyboard.IsKeyDown(Key.LeftShift))
            {
                g.blocking = !g.blocking;
            }
            else if (e.LeftButton == MouseButtonState.Pressed && Keyboard.IsKeyDown(Key.LeftAlt))
            {
                g.nextGasAmount += addamount * 100;
            }
            else if (e.RightButton == MouseButtonState.Pressed && Keyboard.IsKeyDown(Key.LeftAlt))
            {
                g.nextGasAmount += addamount * 1000;
            }
            else if (e.LeftButton == MouseButtonState.Pressed && Keyboard.IsKeyDown(Key.RightShift))
            {
                g.GasVel.X += 1000;
            }
            else if (e.RightButton == MouseButtonState.Pressed && Keyboard.IsKeyDown(Key.RightShift))
            {
                g.GasVel.X += 100000;
            }
            else if (e.LeftButton == MouseButtonState.Pressed)
            {
                g.nextGasAmount += addamount;
            }
            else if (e.RightButton == MouseButtonState.Pressed)
            {
                g.nextGasAmount += addamount * 10;
            }
        }
示例#5
0
 public void InitializeGasCells()
 {
     for (int x = 0; x < _mapSize.Width; x++)
     {
         for (int y = 0; y < _mapSize.Height; y++)
         {
             var e = new Ellipse();
             e.Width  = 15;
             e.Height = 15;
             e.Fill   = Brushes.Blue;
             _canvas.Children.Add(e);
             Canvas.SetLeft(e, (double)x * 15);
             Canvas.SetTop(e, (double)y * 15);
             cellArray[x, y]      = new GasCell(e, x * 15, y * 15, cellArray, this);
             cellArray[x, y].arrX = x;
             cellArray[x, y].arrY = y;
             cellArray[x, y].InitSTP();
         }
     }
 }
示例#6
0
 public void InitializeGasCells()
 {
     for (int x = 0; x < _mapSize.Width; x++)
     {
         for (int y = 0; y < _mapSize.Height; y++)
         {
             var e = new Ellipse();
             e.Width = 15;
             e.Height = 15;
             e.Fill = Brushes.Blue;
             _canvas.Children.Add(e);
             Canvas.SetLeft(e, (double)x * 15);
             Canvas.SetTop(e, (double)y * 15);
             cellArray[x, y] = new GasCell(e, x * 15, y * 15, cellArray, this);
             cellArray[x, y].arrX = x;
             cellArray[x, y].arrY = y;
             cellArray[x, y].InitSTP();
             
         }
     }
 }