Пример #1
0
 public void HandleCollision(TankEngine2D.Graphics.CollisionResult result, ICollideObj objB)
 {
     if (OnCollide != null)
     {
         OnCollide(this, result, (objB as IGameObj).ObjInfo);
     }
 }
Пример #2
0
        public virtual void HandleCollision( CollisionResult result, ICollideObj objB )
        {
            Pos += result.NormalVector * BaseGame.CoordinMgr.LogicLength( 0.5f );

            if (OnCollied != null)
                OnCollied( null, result, (objB as IGameObj).ObjInfo );
        }
Пример #3
0
        void phiUpdater_OnOverlap( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            //if (objB.ObjClass == "Border")
            //{
            //    ((SceneKeeperCommon)(GameManager.CurSceneKeeper)).RemoveGameObj( this, true, false, false, false, SceneKeeperCommon.GameObjLayer.lowFlying );
            //}

            if (onOverlap != null)
                onOverlap( this, result, objB );
        }
Пример #4
0
        internal void MirrorPath(CollisionResult result)
        {
            Vector2 curVel = ((NonInertiasPhiUpdater)this.PhisicalUpdater).Vel;
            float mirVecLength = Vector2.Dot(curVel, result.NormalVector);
            Vector2 horizVel = curVel - mirVecLength * result.NormalVector;
            Vector2 newVel = horizVel + Math.Abs(mirVecLength) * result.NormalVector;
            ((NonInertiasPhiUpdater)this.PhisicalUpdater).Vel = newVel;
            ((NonInertiasPhiUpdater)this.PhisicalUpdater).Azi = MathTools.AziFromRefPos(newVel);

        }
Пример #5
0
        void CollideHandler ( CollisionResult result, GameObjInfo objB )
        {
            if (objB.ObjClass == "Border")
            {
            }
            else if (objB.ObjClass == "ShellNormal")
            {
            }
            else if (objB.ObjClass == "DuelTank")
            {
            }

        }
Пример #6
0
        void Shell_onCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {

            if (objB.ObjClass == "WarShip")
            {
                if (PurviewMgr.IsMainHost)
                {
                    WarShipShell shell = Sender as WarShipShell;
                    WarShip firer = shell.Firer as WarShip;
                    if (objB.Script != firer.ObjInfo.Script)
                    {
                        (shell.Firer as WarShip).Score += SpaceWarConfig.ScoreByHit;
                        SyncShipScoreHp(shell.Firer as WarShip, true);
                    }
                }

                sceneMgr.DelGameObj("shell", Sender.Name);
                new ShellExplodeBeta(Sender.Pos, ((ShellNormal)Sender).Azi);

                Quake.BeginQuake(10, 50);
                Sound.PlayCue("EXPLO1");
            }
            else
            {
                WarShipShell shell = (WarShipShell)Sender;
                shell.MirrorPath(result);

                //
                //BroadcastObjPhiStatus(shell, true);
            }

        }
Пример #7
0
 void Shell_onOverlap( IGameObj Sender, CollisionResult result, GameObjInfo objB )
 {
     if (objB.ObjClass == "Border")
         NiceShootSum = Math.Max( 0, NiceShootSum - 10 );
     //camera.Focus( tank );
 }
Пример #8
0
 void phisicalUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
         InfoRePath.CallEvent(this.mgPath, "OnCollied", OnCollied, this, result, objB);
 }
Пример #9
0
 public void CallOnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
         OnCollied(Sender, result, objB);
 }
Пример #10
0
        /// <summary>
        /// Determines if there is overlap of the non-transparent pixels between two
        /// sprites.
        /// 检查两个精灵是否发生碰撞
        /// </summary>
        /// <returns>True if non-transparent pixels overlap; false otherwise</returns>
        public static CollisionResult IntersectPixels(Sprite spriteA, Sprite spriteB)
        {
            if (!spriteA.mSupportIntersectDect || !spriteB.mSupportIntersectDect)
            {
                throw new Exception("At lest one of the two sprite doesn't support IntersectDect!");
            }

            spriteA.UpdateTransformBounding();
            spriteB.UpdateTransformBounding();

            CollisionResult result = new CollisionResult();

            if (!spriteA.mBounding.Intersects(spriteB.mBounding))
            {
                result.IsCollided = false;
                return(result);
            }

            int widthA  = spriteA.mTexture.Width;
            int heightA = spriteA.mTexture.Height;
            int widthB  = spriteB.mTexture.Width;
            int heightB = spriteB.mTexture.Height;

            // Calculate a matrix which transforms from A's local space into
            // world space and then into B's local space
            Matrix transformAToB = spriteA.mTransform * Matrix.Invert(spriteB.mTransform);

            // When a point moves in A's local space, it moves in B's local space with a
            // fixed direction and distance proportional to the movement in A.
            // This algorithm steps through A one pixel at a time along A's X and Y axes
            // Calculate the analogous steps in B:
            Vector2 stepX = Vector2.TransformNormal(Vector2.UnitX, transformAToB);
            Vector2 stepY = Vector2.TransformNormal(Vector2.UnitY, transformAToB);

            // Calculate the top left corner of A in B's local space
            // This variable will be reused to keep track of the start of each row
            Vector2 oriPosInB = Vector2.Transform(Vector2.Zero, transformAToB);

            CircleList <BorderPoint>     list = spriteA.mBorder.BorderCircle;
            CircleListNode <BorderPoint> cur  = list.First;

            bool justStart = true;
            bool find      = false;

            CircleListNode <BorderPoint> firstNode = cur;
            int length = 0;

            #region 找出第一个相交点和该连续相交线的长度
            for (int i = 0; i < list.Length; i++)
            {
                Point bordPointA = cur.value.p;

                if (SpriteBBlockAtPos(spriteB, oriPosInB, stepX, stepY, bordPointA))
                {
                    if (!justStart)
                    {
                        if (!find)
                        {
                            find      = true;
                            firstNode = cur;
                        }
                        else
                        {
                            length++;
                        }
                    }
                    else
                    {
                        CircleListNode <BorderPoint> temp = cur.pre;
                        while (SpriteBBlockAtPos(spriteB, oriPosInB, stepX, stepY, temp.value.p) && temp != cur)
                        {
                            temp = temp.pre;
                        }
                        cur = temp;
                        i--;
                        justStart = false;
                    }
                }
                else
                {
                    justStart = false;

                    if (find)
                    {
                        break;
                    }
                }

                cur = cur.next;
            }
            #endregion

            if (find)
            {
                cur = firstNode;

                for (int i = 0; i < Math.Round((float)length / 2); i++)
                {
                    cur = cur.next;
                }

                Point bordPointA = cur.value.p;
                result.IsCollided = true;
                Vector2 InterPos = Vector2.Transform(new Vector2(bordPointA.X, bordPointA.Y), spriteA.mTransform);
                result.NormalVector = Vector2.Transform(spriteA.mBorder.GetNormalVector(cur, spriteA.mAverageSum), spriteA.mTransform)
                                      - Vector2.Transform(Vector2.Zero, spriteA.mTransform);
                result.NormalVector.Normalize();
                result.InterPos = InterPos;
                return(result);
            }


            // No intersection found
            result.IsCollided = false;
            return(result);
        }
Пример #11
0
        void tank_onCollide( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            if (objB.ObjClass == "ShellNormal")
            {
                if (Sender == tank1)
                {
                    tank1.Live--;
                    // 在此添加效果
                    tank1.smoke.Concen += 0.2f;

                    if (tank1.Live <= 0 && !tank1.IsDead)
                    {
                        new Explode( tank1.Pos, 0 );

                        tank1.Dead();

                        new GameTimer( 3,
                            delegate()
                            {
                                MessageBox.Show( "Tank2胜利!" );
                                gameOver = true;
                            } );

                    }
                }
                else if (Sender == tank2)
                {
                    tank2.Live--;

                    tank2.smoke.Concen += 0.2f;
                    // 在此添加效果
                    if (tank2.Live <= 0 && !tank2.IsDead)
                    {
                        new Explode( tank2.Pos, 0 );

                        tank2.Dead();

                        new GameTimer( 3,
                            delegate()
                            {
                                MessageBox.Show( "Tank1胜利!" );
                                gameOver = true;
                            } );
                    }
                }
            }
        }
Пример #12
0
 void Gold_OnOverLap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     SetGoldNewPos(Sender as Gold);
 }
Пример #13
0
        void CollideHandler ( CollisionResult result, GameObjInfo objB )
        {
            // 通过objB的信息确定碰撞物的种类。
            if (objB.ObjClass == "Border")
            {
                // 添加自己的处理函数
            }
            else if (objB.ObjClass == "ShellNormal")
            {
                // 添加自己的处理函数
            }
            else if (objB.ObjClass == "DuelTank")
            {
                // 添加自己的处理函数
            }

        }
Пример #14
0
 void phiUpdater_OnOverlap( IGameObj sender, CollisionResult result, GameObjInfo objB )
 {
     if (OnOverlap != null)
         OnOverlap( this, result, objB );
 }
Пример #15
0
        /// <summary>
        /// 检测是否在边界矩形外
        /// </summary>
        /// <param name="BorderRect"></param>
        /// <returns></returns>
        public CollisionResult CheckOutBorder ( Rectanglef BorderRect )
        {
            if (!this.mSupportIntersectDect)
                throw new Exception( "the sprite doesn't support IntersectDect!" );

            UpdateTransformBounding();

            CollisionResult result = new CollisionResult();
            Rectanglef screenRect = BorderRect;


            if (!this.mBounding.Intersects( screenRect ))
            {
                result.IsCollided = false;
                return result;
            }

            int widthA = this.mTexture.Width;
            int heightA = this.mTexture.Height;

            // Calculate a matrix which transforms from A's local space into
            // world space
            Matrix transformAToWorld = mTransform;

            Vector2 stepX = Vector2.TransformNormal( Vector2.UnitX, transformAToWorld );
            Vector2 stepY = Vector2.TransformNormal( Vector2.UnitY, transformAToWorld );

            Vector2 oriPosInWorld = Vector2.Transform( Vector2.Zero, transformAToWorld );


            CircleList<BorderPoint> list = mBorder.BorderCircle;
            CircleListNode<BorderPoint> cur = list.First;

            bool justStart = true;
            bool find = false;

            CircleListNode<BorderPoint> firstNode = cur;
            int length = 0;

            #region 找出第一个相交点和该连续相交线的长度
            for (int i = 0; i < list.Length; i++)
            {
                Point bordPointA = cur.value.p;

                if (PointOutBorder( oriPosInWorld, stepX, stepY, bordPointA, screenRect ))
                {
                    if (!justStart)
                    {
                        if (!find)
                        {
                            find = true;
                            firstNode = cur;
                        }
                        else
                        {
                            length++;
                        }
                    }
                    else
                    {
                        CircleListNode<BorderPoint> temp = cur.pre;

                        int leftLength = list.Length;
                        while (PointOutBorder( oriPosInWorld, stepX, stepY, temp.value.p, screenRect ) && leftLength >= 0)
                        {
                            temp = temp.pre;
                            leftLength--;
                        }
                        cur = temp;
                        i--;
                        justStart = false;
                    }
                }
                else
                {
                    justStart = false;

                    if (find)
                    {
                        break;
                    }
                }

                cur = cur.next;
            }
            #endregion

            if (find)
            {
                cur = firstNode;

                for (int i = 0; i < Math.Round( (float)length / 2 ); i++)
                {
                    cur = cur.next;
                }

                Point bordPointA = cur.value.p;
                result.IsCollided = true;
                Vector2 InterPos = Vector2.Transform( new Vector2( bordPointA.X, bordPointA.Y ), mTransform );
                result.NormalVector = Vector2.Transform( mBorder.GetNormalVector( cur, mAverageSum ), mTransform )
                    - Vector2.Transform( Vector2.Zero, mTransform );
                result.NormalVector.Normalize();
                result.InterPos = InterPos;
                return result;
            }


            // No intersection found
            result.IsCollided = false;
            return result;
        }
Пример #16
0
        /// <summary>
        /// Determines if there is overlap of the non-transparent pixels between two
        /// sprites.
        /// 检查两个精灵是否发生碰撞
        /// </summary>
        /// <returns>True if non-transparent pixels overlap; false otherwise</returns>
        public static CollisionResult IntersectPixels ( Sprite spriteA, Sprite spriteB )
        {
            if (!spriteA.mSupportIntersectDect || !spriteB.mSupportIntersectDect)
                throw new Exception( "At lest one of the two sprite doesn't support IntersectDect!" );

            spriteA.UpdateTransformBounding();
            spriteB.UpdateTransformBounding();

            CollisionResult result = new CollisionResult();

            if (!spriteA.mBounding.Intersects( spriteB.mBounding ))
            {
                result.IsCollided = false;
                return result;
            }

            int widthA = spriteA.mTexture.Width;
            int heightA = spriteA.mTexture.Height;
            int widthB = spriteB.mTexture.Width;
            int heightB = spriteB.mTexture.Height;

            // Calculate a matrix which transforms from A's local space into
            // world space and then into B's local space
            Matrix transformAToB = spriteA.mTransform * Matrix.Invert( spriteB.mTransform );

            // When a point moves in A's local space, it moves in B's local space with a
            // fixed direction and distance proportional to the movement in A.
            // This algorithm steps through A one pixel at a time along A's X and Y axes
            // Calculate the analogous steps in B:
            Vector2 stepX = Vector2.TransformNormal( Vector2.UnitX, transformAToB );
            Vector2 stepY = Vector2.TransformNormal( Vector2.UnitY, transformAToB );

            // Calculate the top left corner of A in B's local space
            // This variable will be reused to keep track of the start of each row
            Vector2 oriPosInB = Vector2.Transform( Vector2.Zero, transformAToB );

            CircleList<BorderPoint> list = spriteA.mBorder.BorderCircle;
            CircleListNode<BorderPoint> cur = list.First;

            bool justStart = true;
            bool find = false;

            CircleListNode<BorderPoint> firstNode = cur;
            int length = 0;

            #region 找出第一个相交点和该连续相交线的长度
            for (int i = 0; i < list.Length; i++)
            {
                Point bordPointA = cur.value.p;

                if (SpriteBBlockAtPos( spriteB, oriPosInB, stepX, stepY, bordPointA ))
                {
                    if (!justStart)
                    {
                        if (!find)
                        {
                            find = true;
                            firstNode = cur;
                        }
                        else
                        {
                            length++;
                        }
                    }
                    else
                    {
                        CircleListNode<BorderPoint> temp = cur.pre;
                        while (SpriteBBlockAtPos( spriteB, oriPosInB, stepX, stepY, temp.value.p ) && temp != cur)
                        {
                            temp = temp.pre;
                        }
                        cur = temp;
                        i--;
                        justStart = false;
                    }
                }
                else
                {
                    justStart = false;

                    if (find)
                    {
                        break;
                    }
                }

                cur = cur.next;
            }
            #endregion

            if (find)
            {
                cur = firstNode;

                for (int i = 0; i < Math.Round( (float)length / 2 ); i++)
                {
                    cur = cur.next;
                }

                Point bordPointA = cur.value.p;
                result.IsCollided = true;
                Vector2 InterPos = Vector2.Transform( new Vector2( bordPointA.X, bordPointA.Y ), spriteA.mTransform );
                result.NormalVector = Vector2.Transform( spriteA.mBorder.GetNormalVector( cur, spriteA.mAverageSum ), spriteA.mTransform )
                    - Vector2.Transform( Vector2.Zero, spriteA.mTransform );
                result.NormalVector.Normalize();
                result.InterPos = InterPos;
                return result;
            }


            // No intersection found
            result.IsCollided = false;
            return result;
        }
Пример #17
0
        void Shell_onCollided( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            //scene.RemoveGameObj( Sender, true, false, false, false, SceneKeeperCommon.GameObjLayer.lowFlying );
            sceneMgr.DelGameObj( "shell", Sender.Name );

            //camera.Focus( tank );
            //if (objB.Name == "Border")
            //{
            //    NiceShootSum = Math.Max( 0, NiceShootSum - 1 );
            //}
        }
Пример #18
0
        void WarShip_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (objB.ObjClass == "WarShipShell")
            {
                WarShip ship = (WarShip)Sender;
                ship.BeginStill();
                if (PurviewMgr.IsMainHost)
                    ship.HitByShell();
                ship.Vel = result.NormalVector * SpaceWarConfig.ShellSpeed;

                SyncShipScoreHp(ship, false);
            }
            else if (objB.ObjClass == "WarShip")
            {
                WarShip ship = (WarShip)Sender;
                Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector);
                ship.Vel = newVel;
                ship.BeginStill();
            }
            else if (objB.ObjClass == "Rock")
            {
                WarShip ship = (WarShip)Sender;
                Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector);
                ship.Vel = newVel;
                ship.BeginStill();
            }
        }
Пример #19
0
        void shell_onCollided( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            sceneMgr.DelGameObj( "shell", Sender.Name );
            new ShellExplodeBeta( Sender.Pos, ((ShellNormal)Sender).Azi );

            Quake.BeginQuake( 10, 50 );
            Sound.PlayCue( "EXPLO1" );

        }
Пример #20
0
        void Warship_OnOverLap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (objB.ObjClass == "Gold")
            {
                WarShip ship = Sender as WarShip;
                ship.Score += SpaceWarConfig.GoldScore;

                SyncShipScoreHp(ship, true);
            }
        }
Пример #21
0
 public virtual void HandleOverlap( CollisionResult result, ICollideObj objB )
 {
     if (OnOverlap != null)
         OnOverlap( null, result, (objB as IGameObj).ObjInfo );
 }
Пример #22
0
        void Rock_OnCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (objB.ObjClass == "WarShip")// || objB.ObjClass == "Rock")
            {
                Vector2 newVel = CalMirrorVel((Sender as Rock).Vel, result.NormalVector);
                (Sender as Rock).Vel = newVel;
            }
            else if (objB.ObjClass == "Rock")
            {
                Vector2 newVel = CalMirrorVel((Sender as Rock).Vel, result.NormalVector);
                (Sender as Rock).Vel = newVel;
            }

            //BroadcastObjPhiStatus(Sender, true);
        }
Пример #23
0
 void phiUpdater_OnCollied( IGameObj Sender, CollisionResult result, GameObjInfo objB )
 {
     if (onCollided != null)
         onCollided( this, result, objB );
 }
Пример #24
0
        /// <summary>
        /// 检测是否在边界矩形外
        /// </summary>
        /// <param name="BorderRect"></param>
        /// <returns></returns>
        public CollisionResult CheckOutBorder(Rectanglef BorderRect)
        {
            if (!this.mSupportIntersectDect)
            {
                throw new Exception("the sprite doesn't support IntersectDect!");
            }

            UpdateTransformBounding();

            CollisionResult result     = new CollisionResult();
            Rectanglef      screenRect = BorderRect;


            if (!this.mBounding.Intersects(screenRect))
            {
                result.IsCollided = false;
                return(result);
            }

            int widthA  = this.mTexture.Width;
            int heightA = this.mTexture.Height;

            // Calculate a matrix which transforms from A's local space into
            // world space
            Matrix transformAToWorld = mTransform;

            Vector2 stepX = Vector2.TransformNormal(Vector2.UnitX, transformAToWorld);
            Vector2 stepY = Vector2.TransformNormal(Vector2.UnitY, transformAToWorld);

            Vector2 oriPosInWorld = Vector2.Transform(Vector2.Zero, transformAToWorld);


            CircleList <BorderPoint>     list = mBorder.BorderCircle;
            CircleListNode <BorderPoint> cur  = list.First;

            bool justStart = true;
            bool find      = false;

            CircleListNode <BorderPoint> firstNode = cur;
            int length = 0;

            #region 找出第一个相交点和该连续相交线的长度
            for (int i = 0; i < list.Length; i++)
            {
                Point bordPointA = cur.value.p;

                if (PointOutBorder(oriPosInWorld, stepX, stepY, bordPointA, screenRect))
                {
                    if (!justStart)
                    {
                        if (!find)
                        {
                            find      = true;
                            firstNode = cur;
                        }
                        else
                        {
                            length++;
                        }
                    }
                    else
                    {
                        CircleListNode <BorderPoint> temp = cur.pre;

                        int leftLength = list.Length;
                        while (PointOutBorder(oriPosInWorld, stepX, stepY, temp.value.p, screenRect) && leftLength >= 0)
                        {
                            temp = temp.pre;
                            leftLength--;
                        }
                        cur = temp;
                        i--;
                        justStart = false;
                    }
                }
                else
                {
                    justStart = false;

                    if (find)
                    {
                        break;
                    }
                }

                cur = cur.next;
            }
            #endregion

            if (find)
            {
                cur = firstNode;

                for (int i = 0; i < Math.Round((float)length / 2); i++)
                {
                    cur = cur.next;
                }

                Point bordPointA = cur.value.p;
                result.IsCollided = true;
                Vector2 InterPos = Vector2.Transform(new Vector2(bordPointA.X, bordPointA.Y), mTransform);
                result.NormalVector = Vector2.Transform(mBorder.GetNormalVector(cur, mAverageSum), mTransform)
                                      - Vector2.Transform(Vector2.Zero, mTransform);
                result.NormalVector.Normalize();
                result.InterPos = InterPos;
                return(result);
            }


            // No intersection found
            result.IsCollided = false;
            return(result);
        }
Пример #25
0
 void phiUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (onOverlap != null)
         //onOverlap( this, result, objB );
         InfoRePath.CallEvent(this.MgPath, "onOverlap", onOverlap, this, result, objB);
 }
Пример #26
0
 public void CallOnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
         OnOverLap(Sender, result, objB);
 }
Пример #27
0
        /// <summary>
        /// 处理重叠,空函数
        /// </summary>
        /// <param name="result"></param>
        /// <param name="objB"></param>
        public void HandleOverlap( CollisionResult result, ICollideObj objB )
        {

        }
Пример #28
0
 void phisicalUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
         InfoRePath.CallEvent(this.mgPath, "OnOverlap", OnOverLap, this, result, objB);
 }
Пример #29
0
        void controller_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (onCollide != null)
                //onCollide(this, result, objB);
                InfoRePath.CallEvent(this.MgPath, "onCollide", onCollide,  this, result, objB);

            if (OnCollide != null)
                //OnCollide(result, objB);
                InfoRePath.CallEvent(this.MgPath, "OnCollide", OnCollide, result, objB);
        }
Пример #30
0
 void phiUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (onCollided != null)
         //onCollided( this, result, objB );
         InfoRePath.CallEvent(this.MgPath, "onCollided", onCollided, this, result, objB);
 }
Пример #31
0
        //float lastCollideWithBorderTime = -1;
        void item_OnCollided( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {

            if (objB.ObjClass == "Border")
            {
                ((ItemCommon)Sender).Vel = -2 * Vector2.Dot( ((ItemCommon)Sender).Vel, result.NormalVector ) * result.NormalVector + ((ItemCommon)Sender).Vel;

                //float curTime = GameManager.CurTime;
                //if (lastCollideWithBorderTime != -1 && curTime - lastCollideWithBorderTime < 0.05f)
                //    ((ItemCommon)Sender).Scale -= 0.1f * 0.25f;

                //lastCollideWithBorderTime = curTime;
            }
            else if (objB.ObjClass == "Tank")
            {
                //((ItemCommon)Sender).Scale += 0.1f * 0.25f;
                //((ItemCommon)Sender).Pos += result.NormalVector * 10f;
                ((ItemCommon)Sender).Vel = ((ItemCommon)Sender).Vel.Length() * result.NormalVector;


                if (firstHitTank)
                {
                    showFirstHitTank = true;
                    firstHitTank = false;
                }
            }
            else if (objB.ObjClass == "ShellNormal")
            {
                smoke.Concen += 0.3f;

                if (((ItemCommon)Sender).Scale < 0.5f * 0.031f)
                {
                    //scene.RemoveGameObj( Sender, true, false, false, false, SceneKeeperCommon.GameObjLayer.HighBulge );
                    sceneMgr.DelGameObj( "shell", Sender.Name );
                    Score += 100;

                    hitSum++;

                    AddNewItem( Sender );

                    if (firstScore)
                    {
                        showFirstScore = true;
                        firstScore = false;
                    }

                    smoke.Concen = 0;
                }
                else
                {
                    ((ItemCommon)Sender).Scale -= 0.15f * 0.031f;
                    ((ItemCommon)Sender).Vel = -result.NormalVector * ((ItemCommon)Sender).Vel.Length();
                    hitSum++;
                }

                if (firstHit)
                {
                    showFirstHit = true;
                    firstHit = false;
                }

                NiceShootSum += 2;
                showNiceShoot = true;

                if (NiceShootSum >= 30 && !speedy)
                {
                    TextEffectMgr.AddRiseFade( "You Got A Speedy Turret!", tank.Pos, 2f, Color.Purple, LayerDepth.Text, GameFonts.Lucida, 300, 0.2f );
                    tank.FireCDTime = 2f;
                    speedy = true;
                }
            }

        }
Пример #32
0
 public CollisionResultGroup ( ICollideObj colA, ICollideObj colB, CollisionResult result )
 {
     this.colA = colA;
     this.colB = colB;
     this.result = result;
 }
Пример #33
0
        void controller_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (onOverLap != null)
                //onOverLap(this, result, objB);
                InfoRePath.CallEvent(this.MgPath, "onOverLap", onOverLap, this, result, objB);

            if (OnOverLap != null)
                //OnOverLap(result, objB);
                InfoRePath.CallEvent(this.MgPath, "OnOverLap", OnOverLap,  result, objB);
        }