當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。