예제 #1
0
        //public override void Kill()
        //{
        //    base.Kill();
        //    Image.Visibility = Visibility.Visible;
        //    Image.Width = 100;
        //    Image.Width = 150;
        //    SetImageSource("/Assets/Characters/Playable/Baby_Yoda.png");

        //}

        public void BossLogic(Canvas canvas, Player player, Map map)
        {
            if (!IsPlayerInShovingRange(player))
            {
                if (++_shotCounter % _shotInterval == 0)
                {
                    ReturnFire(canvas, map);

                    if (!Projectiles.OfType <Bolder>().Any())
                    {
                        Point fuelPoint = GetPositionInCanvas();
                        if (_walkingDiraction)
                        {
                            fuelPoint.Left = canvas.Width - 50;
                            fuelPoint.Top += 500;
                        }
                        else
                        {
                            fuelPoint.Left = 0;
                            fuelPoint.Top += 500;
                        }

                        //create a fuel tank only one at a time
                        if (!map.GetFixedObjects().OfType <FuelTank>().Any())
                        {
                            map.CreateAndAddFixedObjectToMap(new FuelTank(), fuelPoint.Left, fuelPoint.Top);
                        }

                        //roll bolder
                        RollBolder(canvas, map);
                    }
                }
                if (!_walkingDiraction)
                {
                    MoveLeft();
                }
                else
                {
                    MoveRight(canvas);
                }
            }
            else
            {
                ShoveAndDmgPlayer(canvas, player);
            }
        }