• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Collisions.CollisionData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Game.Collisions.CollisionData的典型用法代码示例。如果您正苦于以下问题:C# CollisionData类的具体用法?C# CollisionData怎么用?C# CollisionData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CollisionData类属于Game.Collisions命名空间,在下文中一共展示了CollisionData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FireMarioRedMushroomTopSideCollisionTest

        public void FireMarioRedMushroomTopSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            expectedMario.Flower();
            testMario.Flower();

            RedMushroom testRedMushroom = new RedMushroom(game);
            RedMushroom expectedRedMushroom = new RedMushroom(game);
            expectedRedMushroom.Disappear();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testRedMushroom, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is FireRightIdleState;
            bool expectedState = expectedMario.MarioState is FireRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:25,代码来源:FireMarioRedMushroomCollisionTests.cs


示例2: SmallMarioStarRightSideCollisionTest

        public void SmallMarioStarRightSideCollisionTest()
        {
            WorldManager.LoadListFromFile("World1-1", game);
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            expectedMario.Star();

            Star testStar = new Star(game);
            Star expectedStar = new Star(game);
            expectedStar.Disappear();

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testStar, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is SmallRightIdleState;
            bool expectedState = expectedMario.MarioState is SmallRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:25,代码来源:SmallMarioStarCollisionTests.cs


示例3: BigMarioGreenMushroomRightSideCollisionTest

        public void BigMarioGreenMushroomRightSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            testMario.Mushroom();
            expectedMario.Mushroom();

            GreenMushroom testGreenMushroom = new GreenMushroom(game);
            GreenMushroom expectedGreenMushroom = new GreenMushroom(game);
            expectedGreenMushroom.Disappear();

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testGreenMushroom, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is NormalRightIdleState;
            bool expectedState = expectedMario.MarioState is NormalRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:25,代码来源:BigMarioGreenMushrromCollisionTests.cs


示例4: NormalMarioKoopaLeftSideCollisionTest

        public void NormalMarioKoopaLeftSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(-1, 0);

            testMario.MarioState = new NormalRightIdleState(testMario);
            expectedMario.MarioState = new NormalRightIdleState(expectedMario);

            expectedMario.Damage();

            GreenKoopa testGreenKoopa = new GreenKoopa(game);
            testGreenKoopa.VectorCoordinates = new Vector2(14, 0);

            ICollisionSide side = new LeftSideCollision();
            CollisionData collision = new CollisionData(testMario, testGreenKoopa, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is SmallRightIdleState;
            bool expectedState = expectedMario.MarioState is SmallRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:28,代码来源:NormalMarioKoopaCollisionTest.cs


示例5: FireMarioGoombaRightSideCollisionTest

        public void FireMarioGoombaRightSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);
            testMario.VectorCoordinates = new Vector2(14, 0);
            IMario expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(16, 0);

            testMario.MarioState = new FireRightIdleState(testMario);
            expectedMario.MarioState = new FireRightIdleState(expectedMario);

            expectedMario.Damage();

            Goomba testGoomba = new Goomba(game);

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is NormalRightIdleState;
            bool expectedState = expectedMario.MarioState is NormalRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:28,代码来源:FireMarioGoombaCollisionTest.cs


示例6: BigMarioFlowerLeftSideCollisionTest

        public void BigMarioFlowerLeftSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            testMario.Mushroom();
            expectedMario.Mushroom();
            expectedMario.Flower();

            Flower testFlower = new Flower(game);
            Flower expectedFlower = new Flower(game);
            expectedFlower.Disappear();

            ICollisionSide side = new LeftSideCollision();
            CollisionData collision = new CollisionData(testMario, testFlower, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is FireRightIdleState;
            bool expectedState = expectedMario.MarioState is FireRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:26,代码来源:BigMarioFlowerCollisionTests.cs


示例7: ProjectileTileCollisionHandler

 public ProjectileTileCollisionHandler(CollisionData collision)
 {
     if (collision.GameObjectA is IProjectile)
     {
         projectile = (IProjectile)collision.GameObjectA;
     }
     else
     {
         projectile = (IProjectile)collision.GameObjectB;
     }
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:11,代码来源:ProjectileTileCollisionHandler.cs


示例8: WolverinePipeCollisionHandler

 public WolverinePipeCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IWolverine)
     {
         enemy = (IWolverine)collision.GameObjectA;
     }
     else
     {
         enemy = (IWolverine)collision.GameObjectB;
         collisionSide = collisionSide.FlipSide();
     }
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:14,代码来源:WolverinePipeCollisionHandler.cs


示例9: BuckeyeTileCollisionHandler

 public BuckeyeTileCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IBuckeyePlayer)
     {
         player = (IBuckeyePlayer)collision.GameObjectA;
     }
     else
     {
         player = (IBuckeyePlayer)collision.GameObjectB;
         collisionSide = collisionSide.FlipSide();
     }
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:14,代码来源:BuckeyeTileCollisionHandler.cs


示例10: PaddleBlockCollisionHandler

 public PaddleBlockCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IPaddle)
     {
         paddle = (IPaddle)collision.GameObjectA;
     }
     else
     {
         paddle = (IPaddle)collision.GameObjectB;
         collisionSide = collisionSide.FlipSide();
     }
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:14,代码来源:PaddleBlockCollisionHandler.cs


示例11: PaddleBallItemCollisionHandler

 public PaddleBallItemCollisionHandler(CollisionData collision, IGameState gameState)
 {
     brickBreakerGameState = gameState;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IPaddle)
     {
         paddleBall = (IPaddleBall)collision.GameObjectA;
         collidingItem = (IItem)collision.GameObjectB;
     }
     else
     {
         paddleBall = (IPaddleBall)collision.GameObjectB;
         collidingItem = (IItem)collision.GameObjectA;
         collisionSide = collisionSide.FlipSide();
     }
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:16,代码来源:PaddleBallItemCollisionHandler.cs


示例12: PaddleBallBlockCollisionHandler

 public PaddleBallBlockCollisionHandler(CollisionData collision, IGameState gameState)
 {
     this.collision = collision;
     brickBreakerGameState = gameState;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IPaddleBall)
     {
         collidingBall = (IPaddleBall)collision.GameObjectA;
         collidingBlock = (IBlock)collision.GameObjectB;
     }
     else
     {
         collidingBall = (IPaddleBall)collision.GameObjectB;
         collidingBlock = (IBlock)collision.GameObjectA;
         collisionSide = collisionSide.FlipSide();
     }
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:17,代码来源:PaddleBallBlockCollisionHandler.cs


示例13: BuckeyeWolverineCollisionHandler

        public BuckeyeWolverineCollisionHandler(CollisionData collision)
        {
            this.collision = collision;

            side = collision.CollisionSide;
            if (collision.GameObjectA is IBuckeyePlayer)
            {
                player = (IBuckeyePlayer)collision.GameObjectA;
                enemy = (IWolverine)collision.GameObjectB;
            }
            else
            {
                player = (IBuckeyePlayer)collision.GameObjectB;
                enemy = (IWolverine)collision.GameObjectA;
                side = side.FlipSide();
            }
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:17,代码来源:BuckeyeWolverineCollisionHandler.cs


示例14: BuckeyePipeCollisionHandler

        public BuckeyePipeCollisionHandler(CollisionData collision, IGameState gameState)
        {
            this.collision = collision;
            this.gameState = gameState;

            side = collision.CollisionSide;
            if (collision.GameObjectA is IBuckeyePlayer)
            {
                player = (IBuckeyePlayer)collision.GameObjectA;
                pipe = (IPipe)collision.GameObjectB;
            }
            else
            {
                player = (IBuckeyePlayer)collision.GameObjectB;
                pipe = (IPipe)collision.GameObjectA;
                side = side.FlipSide();
            }
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:18,代码来源:BuckeyePipeCollisionHandler.cs


示例15: FireMarioHiddenBlockTopSideCollisionTest

        public void FireMarioHiddenBlockTopSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);

            Block testBlock = new Block(Block.Type.HiddenBlock, game);
            Block expectedBlock = new Block(Block.Type.HiddenBlock, game);

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testBlock, side);
            MarioBlockCollisionHandler collisionHandler = new MarioBlockCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is FireRightIdleState;
            bool expectedState = expectedMario.MarioState is FireRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:22,代码来源:FireMarioHiddenBlockCollisionTests.cs


示例16: SmallMarioCoinTopSideCollisionTest

        public void SmallMarioCoinTopSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);

            Coin testCoin = new Coin(game);
            Coin expectedCoin = new Coin(game);
            expectedCoin.Disappear();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testCoin, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is SmallRightIdleState;
            bool expectedState = expectedMario.MarioState is SmallRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:23,代码来源:SmallMarioCoinCollisionTests.cs


示例17: BigMarioQuestionBlockRightSideCollisionTest

        public void BigMarioQuestionBlockRightSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);

            Block testBlock = new Block(Block.Type.QuestionBlock, game);
            Block expectedBlock = new Block(Block.Type.QuestionBlock, game);
            expectedMario.VectorCoordinates = new Vector2(12, 0);

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testBlock, side);
            MarioBlockCollisionHandler collisionHandler = new MarioBlockCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is NormalRightIdleState;
            bool expectedState = expectedMario.MarioState is NormalRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:23,代码来源:BigMarioQuestionBlockCollisionTests.cs


示例18: SmallMarioGoombaBottomSideCollisionTest

        public void SmallMarioGoombaBottomSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);
            testMario.VectorCoordinates = new Vector2(0, 14);
            IMario expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(0, 16);
            expectedMario.Damage();

            Goomba testGoomba = new Goomba(game);

            ICollisionSide side = new BottomSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is DeadMarioState;
            bool expectedState = expectedMario.MarioState is DeadMarioState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:24,代码来源:SmallMarioGoombaCollisionTest.cs


示例19: SmallMarioGoombaTopSideCollisionTest

        public void SmallMarioGoombaTopSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);

            Goomba testGoomba = new Goomba(game);
            testGoomba.VectorCoordinates = new Vector2(0, 14);
            Goomba expectedGoomba = new Goomba(game);
            expectedGoomba.Hit();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testGoomba.state is GoombaSmashedState;
            bool expectedState = expectedGoomba.state is GoombaSmashedState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = new Vector2(0, -1);

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:23,代码来源:SmallMarioGoombaCollisionTest.cs


示例20: StarSmallMarioGoombaTopCollisionTest

        public void StarSmallMarioGoombaTopCollisionTest()
        {
            WorldManager.LoadListFromFile("World1-1", game);
            IMario testMario = WorldManager.GetMario();
            testMario.Star();
            testMario = WorldManager.GetMario();
            testMario.VectorCoordinates = new Vector2(0, 0);

            Goomba testGoomba = new Goomba(game);
            testGoomba.VectorCoordinates = new Vector2(0, 14);
            Goomba expectedGoomba = new Goomba(game);
            expectedGoomba.Flipped();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testGoomba.state is GoombaFlippedState;
            bool expectedState = expectedGoomba.state is GoombaFlippedState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = new Vector2(0, -1);

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:27,代码来源:SmallMarioGoombaCollisionTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Object.Living类代码示例发布时间:2022-05-26
下一篇:
C# Packets.GSPacketIn类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap