Exemplo n.º 1
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            bool nodef = false;
            DefaultHitSound = "";

            if(!Silent) PlayBlockSound(ballhit, "METAL");
            RaiseBlockHit(parentstate, ballhit, ref nodef);

            //temporary code for testing powerup:
            //invincible blocks will now "emerge" a mushroom.
            //MushroomPower mp = new MushroomPower(this);
            //parentstate.GameObjects.AddLast(mp);

            return false;
        }
Exemplo n.º 2
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit, ref List<cBall> ballsadded)
        {
            BASeBlock.BCBlockGameState.Soundman.PlaySound("1UP", 0.9f);
            Block.PlayDefaultSound(ballhit);
            //base.AddScore(parentstate, 40);
            //no idea why the above is broken...
            float useangle = (float)BCBlockGameState.rgen.NextDouble() * (float)(2 * Math.PI);
            PointF spawnlocation = new PointF((float)BlockRectangle.Left+(BlockRectangle.Width/2),(float)BlockRectangle.Top + (BlockRectangle.Height/2));

            float useXSpeed = (float)Math.Sin(useangle) * spawnvelocity;
            float useYSpeed = (float)Math.Cos(useangle) * spawnvelocity;
            PointF spawnvel = new PointF(useXSpeed,useYSpeed);
            ballsadded.Add(new cBall(spawnlocation,spawnvel));
            StandardSpray(parentstate, ballhit);

            return true;
        }
Exemplo n.º 3
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            var ballrel = getBallRelative(ballhit);

            //we only take damage if we are hit on one of the sides...
            if (ballrel == BallRelativeConstants.Relative_Left || ballrel == BallRelativeConstants.Relative_Right)
            {
                Damage++;
                base.PerformBlockHit(parentstate, ballhit);
                return Health < Damage;
            }
            else
            {
                base.PerformBlockHit(parentstate, ballhit);
                return false;

            }
        }
Exemplo n.º 4
0
        public override void calcball(Paddle onPaddle, cBall withball)
        {
            //technique:
            //the assumption I can make pretty easily based on my knowledge of how the game works
            //is that calcball will be called for each ball that impacts the paddle.
            //this is the perfect time to do the following (for the "sticky" effect:
            BCBlockGameState gstate = (BCBlockGameState) onPaddle.wGameState.Target;
            if (gstate != null)
            {
                if (gstate.ClientObject.DemoMode)
                    return;
                //ignore this behaviour if in demo mode...
            }

            //base.calcball(withball);
            //add this ball to our "stuckballs" collection; make sure it's "eligible" first...
            if (canbestuck(onPaddle, withball))
                stickball(onPaddle, withball);
        }
Exemplo n.º 5
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            float mindimension = Math.Min(BlockRectangle.Width, BlockRectangle.Height);
            if (mindimension > _MinimumSize)
            {
                //split us in half.
                RectangleF newA, newB; //the "new" block rectangles.
                if (BlockRectangle.Width > BlockRectangle.Height)
                {
                    //split vertically.
                    newA = new RectangleF(BlockRectangle.Left, BlockRectangle.Top, BlockRectangle.Width / 2, BlockRectangle.Height);
                    newB = new RectangleF(BlockRectangle.Left + BlockRectangle.Width / 2, BlockRectangle.Top, BlockRectangle.Width / 2, BlockRectangle.Height);

                }
                else
                {
                    //split horizontally.
                    newA = new RectangleF(BlockRectangle.Left, BlockRectangle.Top, BlockRectangle.Width, BlockRectangle.Height / 2);
                    newB = new RectangleF(BlockRectangle.Left, BlockRectangle.Top + BlockRectangle.Height / 2, BlockRectangle.Width, BlockRectangle.Height / 2);

                }

                parentstate.Blocks.AddLast(new SplitBlock(newA));
                parentstate.Blocks.AddLast(new SplitBlock(newB));
                parentstate.Forcerefresh = true;

                BCBlockGameState.Soundman.PlaySound("bbounce");

            }
            else
            {
                Block.PlayDefaultSound(ballhit);
            }

            return true; //we are destroyed.
        }
 public override bool Impact(Paddle onPaddle, cBall withBall)
 {
     return false;
 }
Exemplo n.º 7
0
 protected override Particle AddStandardSprayParticle(BCBlockGameState parentstate, cBall ballhit)
 {
     return AddStandardSprayParticle<DustParticle>(parentstate, ballhit);
 }
Exemplo n.º 8
0
        //accepts a BombBlockShotDirections enumeration, and returns a list of the appropriate
        //set of balls that would be "exploded" from the bomb block when hit by impactball.
        private List<cBall> GetBallsForDirections(BombBlockShotDirections bbdirection, cBall impactBall)
        {
            PointF usepoint = new PointF(BlockRectangle.Left + BlockRectangle.Width / 2, BlockRectangle.Top + BlockRectangle.Height / 2);
            cBall ballhit = impactBall;
            cBall LeftShoot = new cBall(usepoint, new PointF(-ballhit.getMagnitude(), 0)) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            cBall RightShoot = new cBall(usepoint, new PointF(ballhit.getMagnitude(), 0)) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            cBall TopShoot = new cBall(usepoint, new PointF(0, -ballhit.getMagnitude())) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            cBall BottomShoot = new cBall(usepoint, new PointF(0, ballhit.getMagnitude())) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            float usevel = (float)Math.Sqrt(Math.Pow(ballhit.getMagnitude(), 2) * 2);

            cBall UpLeftShoot = new cBall(usepoint, new PointF(-usevel, -usevel)) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            cBall UpRightShoot = new cBall(usepoint, new PointF(usevel, -usevel)) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            cBall DownLeftShoot = new cBall(usepoint, new PointF(-usevel, usevel)) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            cBall DownRightShoot = new cBall(usepoint, new PointF(usevel, usevel)) { Radius = 3, isTempBall = true, DrawColor = Color.Gray };
            List<cBall> returnballs = new List<cBall>();
            List<cBall> ballsadded = new List<cBall>();
            ballsadded.AddRange(new cBall[] { LeftShoot, RightShoot, TopShoot, BottomShoot, UpLeftShoot, UpRightShoot, DownLeftShoot, DownRightShoot });
            for (int i = 0; i < ballsadded.Count; i++)
            {
                BombBlockShotDirections checkit = ((BombBlockShotDirections)(Math.Pow(2, i + 1)));
                if (((bbdirection & ((BombBlockShotDirections)checkit)) == checkit))
                    returnballs.Add(ballsadded[i]);

            }
            return returnballs;
        }
Exemplo n.º 9
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            //this block will be destroyed. However, we start A timer.
            StartFrustration = DateTime.Now;
            LastFrustrate = DateTime.Now;
            if (FrustratorTimer == null)
            {
                //if it's not null, ignore; a 'frustration' is already occuring. we will reset it's attributes, though.

                //since it is, we need to start it up.
                FrustratorTimer = new System.Threading.Timer((TimerCallback)FrustrationTimerProc, parentstate,
                                                             100, (int)(Frustrationlength.TotalMilliseconds / Frustrationperiod.TotalMilliseconds));

            }

            base.PerformBlockHit(parentstate, ballhit);
            return true;
        }
Exemplo n.º 10
0
 public override bool Impact(Paddle onPaddle, cBall withBall)
 {
     //throw new NotImplementedException();
     return false;
 }
Exemplo n.º 11
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            if (CurrentMode == PowerupBlockMode.BlockMode_Filled)
            {
                if (isEmergePower())
                {
                    try
                    {
                        TransitoryBlockObject tbo = new TransitoryBlockObject(this);
                        parentstate.Defer(()=>parentstate.GameObjects.AddLast(tbo));
                        tbo.TransitionComplete = TransitFunc;
                        CurrentMode = PowerupBlockMode.BlockMode_Transitory;

                        BumpObjects(parentstate);
                    }
                    catch (Exception err)
                    {
                        Debug.Print(err.ToString());

                    }
                }
                else
                {
                    //call transitfunc directly.
                    TransitFunc(parentstate, null);

                }
            }
            base.PerformBlockHit(parentstate, ballhit);
            BCBlockGameState.Soundman.PlaySound("bump");
            return false;
        }
Exemplo n.º 12
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            base.PerformBlockHit(parentstate, ballhit);
            //BCBlockGameState.Soundman.PlaySound("BBounce",1.0f);
            base.PlayBlockSound(ballhit, "METAL2");
            AddScore(parentstate, 20 * (numhits));
            numhits++;
            int indexuse = numhits;
            if (indexuse > ourImages.Length - 1) indexuse = ourImages.Length - 1;
            BlockImageKey = ourImages[indexuse];
            hasChanged = true;
            if (totalstrength < numhits)
            {

                return true;

            }
            return false;
        }
 public override bool Impact(Paddle onPaddle, cBall withBall)
 {
     BCBlockGameState.Soundman.PlaySoundRnd("gren");
     return false;
 }
Exemplo n.º 14
0
 public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
 {
     AddScore(parentstate, 30);
     PlayBlockSound(ballhit, "BOUNCE");
     return base.PerformBlockHit(parentstate, ballhit);
 }
Exemplo n.º 15
0
        protected override void StandardSpray(BCBlockGameState parentstate, cBall ballhit)
        {
            //add lightorbs, too!
            //one in each cardinal direction.
            double usespeed = 4;
            double currangle = 0;
            double angleincrement = Math.PI / 4;
            while (currangle < Math.PI * 2)
            {
                PointF velocityuse = new PointF((float)(Math.Cos(currangle) * usespeed), (float)(Math.Sin(currangle) * usespeed));
                LightOrb makeorb = new LightOrb(BlockRectangle.CenterPoint(), SwitchData[State].StateColor, 24);
                makeorb.Velocity = velocityuse;
                parentstate.Particles.Add(makeorb);

                currangle += angleincrement;
            }
        }
Exemplo n.º 16
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            //tricky business.
            //first, if we are locked, we cannot be affected.
            if (_Locked) return false;

            //otherwise, add to our current state.
            State = (State + 1) % _SwitchData.Count;

            //if enabled, see if all other SwitchBlocks that have the same triggerID at this state index
            //are set to this state.
            var applicableblocks = from b in parentstate.Blocks
                                   where b is SwitchBlockMulti && (b as SwitchBlockMulti).SwitchData.Count >= SwitchData.Count &&
                                       (b as SwitchBlockMulti).SwitchData[State].InvokeID == SwitchData[State].InvokeID
                                   select b as SwitchBlockMulti;

            if (applicableblocks.All((r) => r.State == State))
            {
                //if they are all in this state, fire the trigger.
                Trigger.InvokeTriggerID(SwitchData[State].InvokeID, parentstate);

                //now, destroy the applicable blocks if necessary.
                if (!MultiTrigger)
                {
                    List<Block> removethem = new List<Block>(applicableblocks);
                    parentstate.NextFrameCalls.Enqueue(new BCBlockGameState.NextFrameStartup(() =>
                        {
                            foreach (var removeit in removethem)
                            {
                                removeit.StandardSpray(parentstate);
                                parentstate.Blocks.Remove(removeit);

                            }

                        }));

                }

            }

            return true;
        }
Exemplo n.º 17
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            if (_Locked) return false;
            Active = !Active;
            _hasChanged = true;

            BCBlockGameState.Soundman.PlaySound(Active ? ActiveSound : InactiveSound);
            int IDcheck = Active ? AllActiveID : AllInactiveID;

            IEnumerable<SwitchBlock> dealblocks=null;
            bool triggered = false;
            bool? triggerbool = null;

            if ((SwitchMode & SwitchModeConstants.SwitchMode_MultipleBlock) != SwitchModeConstants.SwitchMode_MultipleBlock)
            {
                //we need to deal with only this block.
                dealblocks = new SwitchBlock[] { this};
            }
            else if ((SwitchMode & SwitchModeConstants.SwitchMode_MultipleBlock)==SwitchModeConstants.SwitchMode_MultipleBlock)
            {
                //we need to work with all blocks in the set that are SwitchBlocks and have the same ID.

                dealblocks = (from t in parentstate.Blocks where t is SwitchBlock && (t as SwitchBlock).ID(Active) == IDcheck select (SwitchBlock)t);
            }
            if (dealblocks == null || !dealblocks.Any())
            {
                //uhhh...
                return false;

            }
            // are all dealblocks activated?
            if (AllActiveID != 0)
            {
                if (dealblocks.All((t) => t.Active))
                {
                    triggered = true;
                    triggerbool = true; //all active.
                    BCBlockGameState.Soundman.PlaySound("laser2");
                    Trigger.InvokeTriggerID(AllActiveID, parentstate);

                }
            }
            if (AllInactiveID != 0)
            {
                if (dealblocks.All((t) => !t.Active))
                {
                    triggered = true;
                    triggerbool = false;
                    BCBlockGameState.Soundman.PlaySound("laser2");
                    Trigger.InvokeTriggerID(AllInactiveID, parentstate);
                }

            }
            if (triggered) //only destroy or reset if we were triggered.
            {
                if ((SwitchMode & SwitchModeConstants.SwitchMode_MultiTrigger) != SwitchModeConstants.SwitchMode_MultiTrigger)
                {
                    //we fire once. if activated, destroy all the blocks we worked with.

                    parentstate.NextFrameCalls.Enqueue(new BCBlockGameState.NextFrameStartup(() =>
                    {
                        var removethese = dealblocks.ToList();
                        foreach (var destroythis in removethese)
                        {
                            destroythis.StandardSpray(parentstate,null);
                            parentstate.Blocks.Remove(destroythis);

                        }
                        parentstate.Forcerefresh = true;
                    }));

                }
                else if ((SwitchMode & SwitchModeConstants.SwitchMode_MultiTrigger) == SwitchModeConstants.SwitchMode_MultiTrigger)
                {
                    //can fire multiple times. Set the state of all affected blocks to false.
                    //We will do this on a time delay, however, and set their "Locked" property to true, preventing
                    //this routine from changing their active state in the future until the delay expires.
                    foreach (var anullthis in dealblocks)
                    {
                        anullthis.Locked = true;
                    }
                    parentstate.DelayInvoke(new TimeSpan(0, 0, 0, 1), (a) =>
                    {
                        parentstate.NextFrameCalls.Enqueue(new BCBlockGameState.NextFrameStartup(() =>
                        {
                            foreach (var unlockit in dealblocks)
                            {
                                unlockit.Active = !(triggerbool.Value);  //invert to old value.
                                unlockit.Locked = false;

                            }
                            parentstate.Forcerefresh = true;
                        }
                        ));
                    });
                }
            }
            return false; //don't destroy.
        }
Exemplo n.º 18
0
        protected override Particle AddStandardSprayParticle(BCBlockGameState parentstate, cBall ballhit)
        {
            PointF middlespot;
            if (ballhit != null)
                middlespot = ballhit.Location;
            else
            {
                middlespot = CenterPoint();
            }
            //return base.AddStandardSprayParticle(parentstate, ballhit);

            float useradius = Math.Min(BlockRectangle.Width, BlockRectangle.Height) / 4;
            Point topleft = new Point((int)cliprect.Left,(int)cliprect.Top);
            Size clipsize = new Size((int)cliprect.Width,(int)cliprect.Height);

            if (ballhit == null)
                return new PolyDebris(middlespot, 3, BlockImage, useradius - 2, useradius + 2, 3, 7,topleft,clipsize);
            else
            {
                return new PolyDebris(ballhit.Location, 3, BlockImage, useradius - 2, useradius + 2, 3, 7,topleft,clipsize);
            }
        }
Exemplo n.º 19
0
 protected override Particle AddStandardSprayParticle(BCBlockGameState parentstate, cBall ballhit)
 {
     if (numhits < totalstrength)
     {
         return AddSprayParticle_Default(parentstate, ballhit);
     }
     else
     {
         return base.AddStandardSprayParticle(parentstate, ballhit);
     }
 }
Exemplo n.º 20
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            //throw new NotImplementedException();
            //spawn the Enemy.
            if(!InstantSpawn)
                InstantiateObject(parentstate);

            return true;
        }
Exemplo n.º 21
0
 public override void calcball(Paddle onPaddle, cBall withball)
 {
     base.calcball(onPaddle, withball);
 }
Exemplo n.º 22
0
 private bool canbestuck(Paddle OnPaddle, cBall checkball)
 {
     return !(checkball.isTempBall) && !(stuckballs.Exists((w) => w == checkball) || buttonApressed);
 }
Exemplo n.º 23
0
        private void ShootFunction(int chargeticks)
        {
            // TerminatorBehaviour Power Levels
            // Each Terminator Power up will add one to the power.
            //Power Level One: Machine gun
            // Power level Two: Shoot a single ball from the center of the paddle upwards.
            // Power Level Three: similar to Level one, but it shoots from each side of the paddle.
            //power level Four: shoots a single laser from the center of the paddle.
            //power level Five: shoots a laser from each side.
            // power level Six: Shoot a single ball from the center of the paddle upwards: however,
            //this will have a laserspinball behaviour, delay set to half a second.
            //power level Seven, same as five, but with laser spin
            //power level eight: SpinShot.

            if (mstate.PlayerPaddle == null) return;

            //only shoot if we are the first in the list of behaviours that are this type....
            if (!mstate.PlayerPaddle.Behaviours.Contains(this)) return;
            if (mstate.PlayerPaddle.Behaviours.First((x) => x.GetType() == typeof (TerminatorBehaviour)) == this)
            {
                if (mstate.PlayerPaddle.Energy == 0)
                {
                    BCBlockGameState.Soundman.PlaySound("shootfail");
                    //and, again, showmanship at work- "shoot" some black light orbs... to simulate smoke...

                    for (int i = 0; i < 6; i++)
                    {
                        PointF usespeed = new PointF(0, (float) (-3 - (BCBlockGameState.rgen.NextDouble())));
                        usespeed = BCBlockGameState.VaryVelocity(usespeed, Math.PI/6);
                        LightOrb addorb = new LightOrb(mstate.PlayerPaddle.Getrect().CenterPoint(),
                                                       BCBlockGameState.rgen.NextDouble() > 0.5d
                                                           ? Color.Black
                                                           : Color.Gray,
                                                       15 + (float) (15*BCBlockGameState.rgen.NextDouble()));
                        addorb.Velocity = usespeed;
                        addorb.VelocityDecay = new PointF(0.9f, 0.85f);
                        mstate.Particles.Add(addorb);
                        //take damage, too...
                    }
                    mstate.PlayerPaddle.HP -= 10;
                    return;
                }
                else
                {
                    BCBlockGameState.Soundman.PlaySound("firelaser");
                }
                mstate.PlayerPaddle.Energy--;
                Paddle pad = mstate.PlayerPaddle;
                RectangleF paddlerect = mstate.PlayerPaddle.Getrect();
                PointF MiddleTop = new PointF(paddlerect.Left + (paddlerect.Width/2), paddlerect.Top);
                PointF LeftTop = new PointF(paddlerect.Left, paddlerect.Top);
                PointF RightTop = new PointF(paddlerect.Right, paddlerect.Top);
                Pen ChosenPenColor = new Pen(Color.Blue, 2);
                //TODO: make it depend on the paddle health. (blue when full, red when damaged).

                //if the powerlevel exceeds MaxPowerup...
                if (PowerLevel > MaxPowerup)
                {
                    MachineGunTimer = new Timer(MachineGun, null, 60, 130); //120 ms delay...
                }
                //if it's larger than powerLevel*2, set it to powerLevel*2...
                if (PowerLevel > PowerLevel*2) PowerLevel = PowerLevel*2;
                int pPowerLevel = ((PowerLevel - 1)%(MaxPowerup)) + 1;
                //Power Level One: Machine gun

                if (pPowerLevel == 1)
                {
                    if (PowerLevel == 1)
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            Bullet firebullet =
                                new Bullet(
                                    new PointF(
                                        mstate.PlayerPaddle.Getrect().Left + (mstate.PlayerPaddle.Getrect().Width/2),
                                        mstate.PlayerPaddle.Getrect().Top),
                                    BCBlockGameState.VaryVelocity(new PointF(0, -10), Math.PI/7));
                            mstate.GameObjects.AddLast(firebullet);
                        }
                    }
                    else
                    {
                        Bullet firebullet =
                            new Bullet(
                                new PointF(
                                    mstate.PlayerPaddle.Getrect().Left + (mstate.PlayerPaddle.Getrect().Width/2),
                                    mstate.PlayerPaddle.Getrect().Top),
                                BCBlockGameState.VaryVelocity(new PointF(0, -10), Math.PI/7));
                        mstate.GameObjects.AddLast(firebullet);
                    }
                }
                else if (pPowerLevel == 2)
                {
                    // Power level Two: Shoot a single ball from the center of the paddle upwards. (temp)
                    cBall shootball = new cBall(MiddleTop,
                                                BCBlockGameState.VaryVelocity(new PointF(0, -8), Math.PI/8));
                    shootball.Radius = 3;
                    shootball.DrawColor = Color.Yellow;
                    shootball.DrawPen = new Pen(Color.GreenYellow);
                    shootball.Behaviours.Add(new TempBallBehaviour());
                    mstate.ShootBalls.AddRange(new cBall[] {shootball});
                }
                else if (pPowerLevel == 3)
                {
                    // Power Level Three: similar to Level one, but it shoots from each side of the paddle.
                    PointF[] Originspots = new PointF[] {LeftTop, RightTop};
                    foreach (PointF ShotOrigin in Originspots)
                    {
                        cBall shootit = new cBall(ShotOrigin,
                                                  BCBlockGameState.VaryVelocity(new PointF(0f, -8.8f), Math.PI/8.8f));
                        shootit.Radius = 3;
                        shootit.DrawColor = Color.Yellow;
                        shootit.DrawPen = new Pen(Color.RoyalBlue);
                        shootit.Behaviours.Add(new TempBallBehaviour());
                        mstate.ShootBalls.Add(shootit);
                    }
                }
                else if (pPowerLevel == 4)
                {
                    //weak hitscan, straight upwards.
                    HitscanBullet hsb = new HitscanBullet(paddlerect.TopCenter(), new PointF(0, -2));
                    hsb.Penetrate = false;
                    hsb.Strength = HitscanBullet.HitscanStrengthConstants.hitscan_bullet;
                    mstate.GameObjects.AddLast(hsb);
                    BCBlockGameState.Soundman.PlaySound("laser2");
                }
                else if (pPowerLevel == 5)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        PointF selectedvelocity = BCBlockGameState.VaryVelocity(new PointF(0, -8), Math.PI/16);
                        HitscanBullet hsb = new HitscanBullet(paddlerect.TopCenter(), selectedvelocity);
                        hsb.Penetrate = false;
                        hsb.Strength = HitscanBullet.HitscanStrengthConstants.hitscan_bullet;
                        mstate.GameObjects.AddLast(hsb);
                        BCBlockGameState.Soundman.PlaySound("laser2");
                    }
                }
                else if (pPowerLevel == 6)
                {
                    //power level Four: shoots a single laser from the center of the paddle.
                    LaserShot ShootLaser = new LaserShot(MiddleTop, new PointF(0, -9), ChosenPenColor, 36);
                    mstate.GameObjects.AddLast(ShootLaser);
                }
                else if (pPowerLevel == 7)
                {
                    PointF[] Originspots = new PointF[] {LeftTop, RightTop};
                    PointF usevelocity = BCBlockGameState.VaryVelocity(new PointF(0f, -8.8f), Math.PI/8.9f);
                    foreach (PointF ShotOrigin in Originspots)
                    {
                        LaserShot ShootLaser = new LaserShot(ShotOrigin, usevelocity, ChosenPenColor);
                        mstate.GameObjects.AddLast(ShootLaser);
                        //power level Five: shoots a laser from each side.
                    }
                }
                else if (pPowerLevel == 8)
                {
                    cBall shootball = new cBall(MiddleTop,
                                                BCBlockGameState.VaryVelocity(new PointF(0f, -1f), Math.PI/10));
                    shootball.Behaviours.Add(new LaserSpinBehaviour(new TimeSpan(0, 0, 0, 0, 300)));
                    shootball.Behaviours.Add(new TempBallBehaviour());
                    shootball.Radius = 3;
                    shootball.DrawColor = Color.Yellow;
                    shootball.DrawPen = new Pen(Color.GreenYellow);
                    mstate.ShootBalls.Add(shootball);
                    // power level Six: Shoot a single ball from the center of the paddle upwards: however,
                    //this will have a laserspinball behaviour, delay set to half a second.
                }
                else if (pPowerLevel == 9)
                {
                    //power level Seven, same as five, but with laser spin
                    //also same as 6 but with two of them...
                    PointF[] Originspots = new PointF[] {LeftTop, RightTop};
                    foreach (PointF ShotOrigin in Originspots)
                    {
                        cBall shootball = new cBall(ShotOrigin,
                                                    BCBlockGameState.VaryVelocity(new PointF(0f, -9f), Math.PI/10));
                        shootball.Behaviours.Add(new LaserSpinBehaviour(new TimeSpan(0, 0, 0, 300)));
                        shootball.Behaviours.Add(new TempBallBehaviour());
                        shootball.Radius = 3;
                        shootball.DrawColor = Color.Yellow;
                        shootball.DrawPen = new Pen(Color.GreenYellow);
                        mstate.ShootBalls.Add(shootball);
                    }
                }
                else if (pPowerLevel == 10)
                {
                    //spinshot
                    PointF selectedspeed = BCBlockGameState.VaryVelocity(new PointF(0, -9f), Math.PI/10);
                    SpinShot shootit = new SpinShot(mstate,
                                                    new PointF(
                                                        mstate.PlayerPaddle.Getrect().Left +
                                                        (mstate.PlayerPaddle.Getrect().Width/2),
                                                        mstate.PlayerPaddle.Getrect().Top), 12, 16,
                                                    ((float) Math.PI/6), selectedspeed);

                    mstate.GameObjects.AddLast(shootit);
                }
            }
            else
            {
                Debug.Print("Terminator Behaviour not first Terminator in behaviours collection... ignoring...");
            }
        }
Exemplo n.º 24
0
        private void stickball(Paddle onPaddle, cBall stickit)
        {
            //"stick" the given ball to the paddle.
            //how? create a new struct instance representing it's various attributes...
            StuckBallData newentry = new StuckBallData();
            newentry.UseVelocity = stickit.Velocity;
            newentry.TheBall = stickit;
            newentry.MiddleOffset = (stickit.Location.X - onPaddle.Position.X);
            stickit.Velocity = new PointF(0, 0);
            Debug.Print("Taking " + stickit.Behaviours.Count.ToString() + " behaviours from ball");
            newentry.BallsBehaviours = stickit.Behaviours;
            stickit.Behaviours = new List<iBallBehaviour>();

            foreach (iBallBehaviour ballbehave in newentry.BallsBehaviours)
            {
                if (
                    System.Attribute.GetCustomAttributes(ballbehave.GetType())
                          .Any((p) => p is StickyNonRemovableAttribute))
                {
                    //contains the StickyNonRemovableAttribute, and thus should be added to the "temporary" behaviours that it is being given.
                    stickit.Behaviours.Add(ballbehave);
                }
            }

            ballstack.Push(newentry);
            stuckballs.Add(stickit);
        }
Exemplo n.º 25
0
 protected override Particle AddStandardSprayParticle(BCBlockGameState parentstate, cBall ballhit)
 {
     return null;
     //no particles.
     //return base.AddStandardSprayParticle(parentstate, ballhit);
 }
Exemplo n.º 26
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            parentstate.Defer(()=>
                              parentstate.GameObjects.AddLast(new ProxyObject(proxyfunction, null)));

            return base.PerformBlockHit(parentstate, ballhit);
        }
Exemplo n.º 27
0
        public override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit)
        {
            parentstate.GameScore += 50;
            BCBlockGameState.Soundman.PlaySound("BOMB", 0.9f);
            //Brush usebrush = new SolidBrush(Color.Gray);
            PointF usepoint = new PointF(BlockRectangle.Left + BlockRectangle.Width / 2, BlockRectangle.Top + BlockRectangle.Height / 2);
            /*
                    cBall LeftShoot = new cBall(usepoint, new PointF(-ballhit.getMagnitude(), 0)) { Radius = 3,isTempBall=true,DrawColor=Color.Gray};
                    cBall RightShoot = new cBall(usepoint, new PointF(ballhit.getMagnitude(), 0)) { Radius = 3, isTempBall = true, DrawColor=Color.Gray };

                    cBall TopShoot = new cBall(usepoint, new PointF(0, -ballhit.getMagnitude())) { Radius = 3, isTempBall = true, DrawColor=Color.Gray};
                    cBall BottomShoot = new cBall(usepoint, new PointF(0, ballhit.getMagnitude())) { Radius = 3, isTempBall = true, DrawColor = Color.Gray};
                    ballsadded.AddRange(new cBall[] { LeftShoot, RightShoot, TopShoot, BottomShoot });*/
            parentstate.NextFrameCalls.Enqueue(new BCBlockGameState.NextFrameStartup(() =>

                                                                                     GetBallsForDirections(mShotDirections, ballhit)));
            //                    parentstate.Balls.AddRangeAfter(new cBall[] { LeftShoot, RightShoot, TopShoot, BottomShoot });
            //parentstate.Balls.AddRange(new cBall[] { LeftShoot, RightShoot, TopShoot, BottomShoot });
            //parentstate.Balls.Add
            StandardSpray(parentstate, ballhit);
            return true;
        }
Exemplo n.º 28
0
 public abstract override bool PerformBlockHit(BCBlockGameState parentstate, cBall ballhit);
Exemplo n.º 29
0
 public override bool Impact(Paddle onPaddle, cBall withBall)
 {
     //maybe splash blood around...
     return false;
 }
Exemplo n.º 30
0
 public abstract bool Impact(Paddle onPaddle, cBall withBall);