Example #1
0
        /// <summary>
        /// Event-handler for when a NonlivingThing is picked up from this CellView's Cell.
        /// </summary>
        /// <param name="nonlivingThing"> the NonlivingThing being picked up from the Cell</param>
        public void NonlivingThingPickedUpEvent(NonlivingThing nonlivingThing)
        {
            NonlivingThingView nonLivingThingView = nonLivingThingViews[nonlivingThing];

            nonLivingThingViews.Remove(nonlivingThing);

            if (nonLivingThingView.DisplayObjectInGridWithinCell)
            {
                numOfObjectsInGrid -= 1;
            }

            Invalidate();  // Cause the OnPaint method to repaint this CellView.
        }
Example #2
0
        /// <summary>
        /// Event-handler for when a NonlivingThing is put down on this CellView's Cell.
        /// </summary>
        /// <param name="nonlivingThing"> the NonlivingThing being put down on the Cell</param>
        public void NonlivingThingPutDownEvent(NonlivingThing nonlivingThing)
        {
            NonlivingThingView nonLivingThingView = (NonlivingThingView)pigWorldView.CreateView(nonlivingThing);

            nonLivingThingViews.Add(nonlivingThing, nonLivingThingView);

            if (nonLivingThingView.DisplayObjectInGridWithinCell)
            {
                numOfObjectsInGrid += 1;
            }

            Invalidate();  // Cause the OnPaint method to repaint this CellView.
        }