Пример #1
0
        public override void OnCheckPosition(DynamicMapObject sender)
        {
            var positionArgs = new PositionChangedArgs(new Rectangle(sender.position.X + sender.dx,
                                                                     sender.position.Y + sender.dy, sender.Width, sender.Height));

            if (positionArgs == null)
            {
                return;
            }
            if (CollidesWith(positionArgs.NewRectangle))
            {
                if ((!((MapObject)sender).toDelete) && (!this.toDelete))
                {
                    if ((sender is Kolobok) && (this.entity is Tank))
                    {
                        this.Die();
                        ((Kolobok)sender).Die();
                    }
                    else if ((sender is Tank) && (this.entity is Kolobok))
                    {
                        this.Die();
                        ((Tank)sender).Die();
                    }
                }
            }
        }
Пример #2
0
        public virtual void OnCheckPosition(DynamicMapObject sender)
        {
            var positionArgs = new PositionChangedArgs(new Rectangle(sender.position.X + sender.dx,
                                                                     sender.position.Y + sender.dy, sender.Width, sender.Height));

            if (positionArgs == null)
            {
                return;
            }

            if (CollidesWith(positionArgs.NewRectangle))
            {
                if ((!((MapObject)sender).toDelete) && (!this.toDelete))
                {
                    if ((sender is Bullet) && (this is Wall))
                    {
                        ((Bullet)sender).Die();
                    }
                    else
                    {
                        ((DynamicMapObject)sender).Deviate();
                    }
                }
            }
        }
Пример #3
0
        public BulletView AddBullet(DynamicMapObject entity, Panel p_Map)
        {
            Rectangle rect   = new Rectangle();
            var       bullet = new Bullet(rect.Location, (int)GameForm.paramsGame["speedBullet"]);

            bullet.IdentifyDirection(entity.DirectionNow);
            bullet.entity = entity;
            gameModel.listBullet.Add(bullet);

            BulletView viewBullet = new BulletView(p_Map);

            viewBullet.Model          = bullet;
            viewBullet.Model.Position = new Point(entity.Position.X, entity.Position.Y);
            viewBullet.Model.MapSize  = new Point(p_Map.Width, p_Map.Height);
            viewBullet.Subscribe();

            return(viewBullet);
        }
Пример #4
0
        public override void OnCheckPosition(DynamicMapObject sender)
        {
            var positionArgs = new PositionChangedArgs(new Rectangle(sender.position.X + sender.dx,
                                                                     sender.position.Y + sender.dy, sender.Width, sender.Height));

            if (positionArgs == null)
            {
                return;
            }
            if (CollidesWith(positionArgs.NewRectangle))
            {
                if ((!((MapObject)sender).toDelete) && (!this.toDelete))
                {
                    if (sender is Kolobok)
                    {
                        Replace();
                        Game.Score += 1;
                    }
                }
            }
        }
Пример #5
0
        private void AddBullet(DynamicMapObject entity)
        {
            var viewBullet = packmanController.AddBullet(entity, p_Map);

            listViewBullet.Add(viewBullet);
        }