mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-26 00:45:20 +00:00
* Created unit test project for collisions. * Started on tests * Created unit test project for collisions. * Started on tests * Update collision test * CollisionInfo docs * More docs for CollisionGrid and Cell * Fix obsolete warning for RectangleF.Intersect * Summary for CollisionGrid and CollisionGridCell * QuadTree collision implemented - Ported from C++ from Game Physics Cookbook chapter 6, 2D Optimizations * Small refactor for QuadTree naming * First tests for QuadTree * Fix test * COde Cleanup * Added DefaultMaxObjectsPerNode * Add missed Query code * Insert Tests and bugfix * Fix bug with QuadTree.Shake * Fix namespaces * Query tests and fix * Additional test for Query * Initial QuadTreeCollision Component * Basic collision demo working * Spikey ball colliding with walls * Improved the collision demo * Update QuadTree * Added comment for CollisionComponent * Ignore test that needs fixed * Rename QuadTree to Quadtree * Fix penetration vector * Update to 2.0 and xUnit
31 lines
763 B
C#
31 lines
763 B
C#
using System;
|
|
using Microsoft.Xna.Framework;
|
|
|
|
namespace MonoGame.Extended.Collisions.Tests
|
|
{
|
|
public class BasicActor : IActorTarget
|
|
{
|
|
public Vector2 Position { get; set; }
|
|
public RectangleF BoundingBox { get; set; }
|
|
public Vector2 Velocity { get; set; }
|
|
|
|
public BasicActor()
|
|
{
|
|
BoundingBox = new RectangleF(0f, 0f, 1f, 1f);
|
|
}
|
|
public void OnCollision(CollisionInfo collisionInfo)
|
|
{
|
|
if (collisionInfo.Other is BasicActor)
|
|
{
|
|
CollisionCount++;
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine(collisionInfo.Other.GetType().Name);
|
|
}
|
|
}
|
|
|
|
public int CollisionCount { get; set; }
|
|
}
|
|
}
|