当前位置: 首页>>代码示例>>C#>>正文


C# BCBlockGameState.invokeballhitbottom方法代码示例

本文整理汇总了C#中BCBlockGameState.invokeballhitbottom方法的典型用法代码示例。如果您正苦于以下问题:C# BCBlockGameState.invokeballhitbottom方法的具体用法?C# BCBlockGameState.invokeballhitbottom怎么用?C# BCBlockGameState.invokeballhitbottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BCBlockGameState的用法示例。


在下文中一共展示了BCBlockGameState.invokeballhitbottom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformFrame

        public virtual List<Block> PerformFrame(BCBlockGameState ParentGameState,ref List<cBall> ballsadded,ref List<cBall> ballsremove)
        {
            PreviousVelocity = Velocity;
            //returns the blocks that were affected by the frame (changed or moved).
            //PointF NextPosition = new PointF(Location.X + Velocity.X, Location.Y + Velocity.Y);
            PointF NextPosition = Location;
            BCBlockGameState.IncrementLocation(ParentGameState, ref NextPosition, Velocity);
            //RectangleF NextPositionBorders = new RectangleF(NextPosition.X - Radius, NextPosition.Y - Radius, Radius, Radius);
            NormalizeSpeed();
            if(ballsadded==null)            ballsadded = new List<cBall>();
            RectangleF rectangleborders = new RectangleF(Location.X-Radius,Location.Y-Radius,Radius*2,Radius*2);
            PrevLocation=Location;
            //Location = new PointF(Location.X+Velocity.X,Location.Y+Velocity.Y);
            Location = NextPosition;

            TrailData.Enqueue(new TrailItemData(Location,Radius));
            while (TrailData.Count > _Trails)
                TrailData.Dequeue();

            BCBlockGameState wholeref = ParentGameState;

            List<Block> affectedblocks = InvokePerformFrame(this, ParentGameState, ref  ballsadded,ref ballsremove);

            if(affectedblocks==null) affectedblocks = new List<Block>();
            if (wholeref != null)
            {

                /*if (isTempBall)
                {

                    for (int i = 0; i < (int)(10 * BCBlockGameState.ParticleGenerationFactor); i++)
                    {
                        ParentGameState.Particles.Add(new FireParticle(this));

                    }

                }*/

                //check for collision with the walls...
                Rectangle clientrect = wholeref.GameArea;
                bool DoEmitSound=false;
                bool didhit=false;
                didhit = CheckWallCollision(rectangleborders, clientrect, ref DoEmitSound);

                //CheckBall.Y + CheckBall.radius >= Paddle.Y And CheckBall.Y - _
                //CheckBall.radius < Paddle.Y + Paddle.PHeight Or (((CheckBall.Y - _
                //CheckBall.Yspeed + CheckBall.radius) >= Paddle.Y And CheckBall.Y - _
                //CheckBall.Yspeed - CheckBall.radius < Paddle.Y + Paddle.PHeight) And _
                //Sgn(CheckBall.Yspeed) = 1)
                if (wholeref.PlayerPaddle != null)
                {
                    /*
                    if (rectangleborders.IntersectsWith(wholeref.PlayerPaddle.Getrect()) && Math.Sign(Velocity.Y) == 1)
                        // Paddle paddle = wholeref.PlayerPaddle;
                        //if((Location.Y + Radius >= paddle.Position.Y) && (Location.Y -
                        //    Radius < paddle.Position.X+paddle.PaddleSize.Width  ) || (((Location.Y - Velocity.Y + Radius) >= paddle.Position.Y &&
                        //    Location.Y - Velocity.Y - Radius < paddle.Position.Y+paddle.PaddleSize.Height) && Math.Sign(Velocity.Y)==1))

                        // if (Location.Y + Radius >= paddle.Position.Y && (Location.Y - Radius <= (paddle.Position.X + paddle.PaddleSize.Width)))
                    {
                        //the X coordinate checks out here...

                        {

                            wholeref.PlayerPaddle.Impact(wholeref, this);

                        }
                    }
                     * */
                    wholeref.PlayerPaddle.CheckImpact(wholeref, this, true);

                }
                bool HitBottom=false;
                if (rectangleborders.Bottom > clientrect.Bottom)
                {

                    didhit = true;
                    HitBottom=true;
                    DoEmitSound=false;

                }
                if (didhit)
                {
                    numImpacts++;
                    switch (invokeHitWall(wholeref, this))
                    {
                        case HitWallReturnConstants.HitBall_Default:
                            if (HitBottom)
                            {
                                ParentGameState.invokeballhitbottom(this);
                                ParentGameState.Defer(() => ParentGameState.Balls.Remove(this));
                            }
                            //

                            break;
                        case HitWallReturnConstants.HitBall_Destroy:

                            ParentGameState.invokeballhitbottom(this);
                            ParentGameState.Defer(() => ParentGameState.Balls.Remove(this));
                            break;
//.........这里部分代码省略.........
开发者ID:BCProgramming,项目名称:BASeBlock,代码行数:101,代码来源:cBall.cs


注:本文中的BCBlockGameState.invokeballhitbottom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。