示例#1
0
 public void React(int id, int count, ICollisionActor actor, CollisionResult result)
 {
     if (actor is AttackCollisionActor)
     {
         AttackReaction(id, count, actor as AttackCollisionActor, result);
     }
 }
 public CollisionActorEventHandler(IPhysics physics, ICollisionActor actor)
 {
     if (actor == null)
     {
         throw new Exception();
     }
     this.actor   = actor;
     this.physics = physics;
 }
示例#3
0
 /// <summary>
 /// Inserts the target into the collision tree.
 /// The target will have its OnCollision called when collisions occur.
 /// </summary>
 /// <param name="target">Target to insert.</param>
 public void Insert(ICollisionActor target)
 {
     if (!_targetDataDictionary.ContainsKey(target))
     {
         var data = new QuadtreeData(target);
         _targetDataDictionary.Add(target, data);
         _collisionTree.Insert(data);
     }
 }
示例#4
0
 /// <summary>
 /// Removes the target from the collision tree.
 /// </summary>
 /// <param name="target">Target to remove.</param>
 public void Remove(ICollisionActor target)
 {
     if (_targetDataDictionary.ContainsKey(target))
     {
         var data = _targetDataDictionary[target];
         _collisionTree.Remove(data);
         _targetDataDictionary.Remove(target);
     }
 }
示例#5
0
 public QueueableCollisionEvent(IPhysics physics, ICollisionActor actor, CollisionEvent e)
 {
     if (actor == null)
     {
         throw new Exception();
     }
     this.actor   = actor;
     this.e       = e;
     this.physics = physics;
 }
示例#6
0
 /// <summary>
 /// Removes the target from the collision tree.
 /// </summary>
 /// <param name="target">Target to remove.</param>
 public void Remove(ICollisionActor target)
 {
     if (_targetDataDictionary.ContainsKey(target))
     {
         var data = _targetDataDictionary[target];
         data.RemoveFromAllParents();
         _targetDataDictionary.Remove(target);
         _collisionTree.Shake();
     }
 }
示例#7
0
        private void Init(ICanyonShooterGame game, ITransformable owner, ICollisionActor collisionActor)
        {
            this.game           = game;
            this.self           = owner;
            this.collisionActor = collisionActor;

            if (game.Physics.MultiThreading)
            {
                collisionEvents = new LockingQueue <QueueableCollisionEvent>();
            }
            else
            {
                collisionEvents = new NonLockingQueue <QueueableCollisionEvent>();
            }
        }
示例#8
0
        public virtual void Dispose()
        {
            ConnectedToXpa = false;

            collisionActor = null;

            self = null;

            collisionEvents.Clear();

            if (physicsObject != null)
            {
                physicsObject.Dispose();
            }

            game.Physics.UnregisterTransformable(this);
        }
示例#9
0
 public Transformable(ICanyonShooterGame game, ITransformable owner, ICollisionActor collisionActor)
 {
     Init(game, owner, collisionActor);
 }
 public void Dispose()
 {
     pendingCollisionEvents.Clear();
     actor = null;
 }
示例#11
0
 public bool Insert(ICollisionActor collisionActor)
 {
     return(_collisionActors.Add(collisionActor));
 }
示例#12
0
 public bool Remove(ICollisionActor collisionActor)
 {
     return(_collisionActors.Remove(collisionActor));
 }
示例#13
0
 public QuadTreeData(Collider collider, ICollisionActor collisionActor)
 {
     Collider       = collider;
     CollisionActor = collisionActor;
 }
示例#14
0
 public QuadtreeData(ICollisionActor target)
 {
     Target = target;
     Bounds = target.Bounds;
     Flag   = false;
 }
示例#15
0
 public void React(int id, int count, ICollisionActor actor, CollisionResult result)
 {
     Reaction(id, count, result);
 }
示例#16
0
 /// <summary>
 /// Gets if the target is inserted in the collision tree.
 /// </summary>
 /// <param name="target">Actor to check if contained</param>
 /// <returns>True if the target is contained in the collision tree.</returns>
 public bool Contains(ICollisionActor target)
 {
     return(_targetDataDictionary.ContainsKey(target));
 }
示例#17
0
 public Transformable(ICanyonShooterGame game, ICollisionActor collisionActor)
 {
     Init(game, this, collisionActor);
 }