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; }
/// <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); } }
/// <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); } }
public QueueableCollisionEvent(IPhysics physics, ICollisionActor actor, CollisionEvent e) { if (actor == null) { throw new Exception(); } this.actor = actor; this.e = e; this.physics = physics; }
/// <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(); } }
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>(); } }
public virtual void Dispose() { ConnectedToXpa = false; collisionActor = null; self = null; collisionEvents.Clear(); if (physicsObject != null) { physicsObject.Dispose(); } game.Physics.UnregisterTransformable(this); }
public Transformable(ICanyonShooterGame game, ITransformable owner, ICollisionActor collisionActor) { Init(game, owner, collisionActor); }
public void Dispose() { pendingCollisionEvents.Clear(); actor = null; }
public bool Insert(ICollisionActor collisionActor) { return(_collisionActors.Add(collisionActor)); }
public bool Remove(ICollisionActor collisionActor) { return(_collisionActors.Remove(collisionActor)); }
public QuadTreeData(Collider collider, ICollisionActor collisionActor) { Collider = collider; CollisionActor = collisionActor; }
public QuadtreeData(ICollisionActor target) { Target = target; Bounds = target.Bounds; Flag = false; }
public void React(int id, int count, ICollisionActor actor, CollisionResult result) { Reaction(id, count, result); }
/// <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)); }
public Transformable(ICanyonShooterGame game, ICollisionActor collisionActor) { Init(game, this, collisionActor); }