public void DrawShaddow(Point innerPoint, Size innerSize) { var drawingGroup = new DrawingGroup(); // Create a DrawingBrush. DrawingBrush myDrawingBrush = new DrawingBrush(); // Create a drawing. GeometryDrawing myBlackDrawing = new GeometryDrawing(); // myGeometryDrawing.Brush myBlackDrawing.Brush = Brushes.Black; myBlackDrawing.Pen = new Pen(Brushes.Black, 1); GeometryGroup rectangle = new GeometryGroup(); rectangle.FillRule = FillRule.EvenOdd; rectangle.Children.Add(new RectangleGeometry(new Rect { Height = _canvas.Height, Width = _canvas.Width })); GeometryGroup rectangle11 = new GeometryGroup(); rectangle11.FillRule = FillRule.Nonzero; rectangle11.Children.Add( new RectangleGeometry(new Rect(new System.Windows.Point(innerPoint.X, innerPoint.Y), new System.Windows.Size(innerSize.Width * 20, innerSize.Height * 20)))); rectangle.Children.Add(rectangle11); var combined = new CombinedGeometry(GeometryCombineMode.Exclude, rectangle, rectangle11); myBlackDrawing.Geometry = combined; drawingGroup.Children.Add(myBlackDrawing); myDrawingBrush.Drawing = drawingGroup; Rectangle rec = new Rectangle { Fill = myDrawingBrush, Stroke = Brushes.Black, Height = _canvas.Height, Width = _canvas.Width, Opacity = 0.5, IsEnabled = false }; _canvas.Children.Add(rec); Canvas.SetLeft(rec, 0); Canvas.SetTop(rec, 0); }
public MobileObject() { ViewSight = new Size(); Position = new Point(); Speed = 2; Angle = 0; StateEvent = new StateEvent(); _stateQueue = new Queue<IState>(); PointList = new List<Point>(); State = new Standing(); Observable.FromEventPattern<StateHandler, StateEventArgs>( ev => StateEvent.NextState += ev, ev => StateEvent.NextState -= ev).Subscribe(staSubject); staSubject.Subscribe(x => { if (_stateQueue.Count == 0) { EnqueueNextState(); } if (_stateQueue.Count > 0) { IState nextState; while (_stateQueue.Count > 0) { nextState = _stateQueue.Dequeue(); if (nextState != State && nextState != null) { State = nextState; return; } } } }); Game.Intervals.CombineLatest(States, (tick, state) => state).Subscribe(x => { if (State != null && CheckForUnExpected()) State.Act(); }); }
public FixedObject(Size size, uint id) { IsPassable = true; Size = size; Id = id; }
public bool Equals(Size other) { return other.Width == Width && other.Height == Height; }