本文整理汇总了C#中Game.Collisions.CollisionData类的典型用法代码示例。如果您正苦于以下问题:C# CollisionData类的具体用法?C# CollisionData怎么用?C# CollisionData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollisionData类属于Game.Collisions命名空间,在下文中一共展示了CollisionData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例7: ProjectileTileCollisionHandler
public ProjectileTileCollisionHandler(CollisionData collision)
{
if (collision.GameObjectA is IProjectile)
{
projectile = (IProjectile)collision.GameObjectA;
}
else
{
projectile = (IProjectile)collision.GameObjectB;
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}