/// <summary>
        /// this method requires that you are using a collision layer setup in the constructor.
        /// </summary>
        /// <returns>The tile at world position.</returns>
        /// <param name="worldPos">World position.</param>
        public TiledTile getTileAtWorldPosition(Vector2 worldPos)
        {
            Insist.isNotNull(collisionLayer, "collisionLayer must not be null!");

            // offset the passed in world position to compensate for the entity position
            worldPos -= entity.transform.position + _localOffset;
            return(collisionLayer.getTileAtWorldPosition(worldPos));
        }
        /// <summary>
        /// gets all the non-empty tiles that intersect the passed in bounds for the collision layer. The returned List can be put back in the
        /// pool via ListPool.free.
        /// </summary>
        /// <returns>The tiles intersecting bounds.</returns>
        /// <param name="bounds">Bounds.</param>
        public List <TiledTile> getTilesIntersectingBounds(Rectangle bounds)
        {
            Insist.isNotNull(collisionLayer, "collisionLayer must not be null!");

            // offset the passed in world position to compensate for the entity position
            bounds.Location -= (entity.transform.position + _localOffset).ToPoint();
            return(collisionLayer.getTilesIntersectingBounds(bounds));
        }
Esempio n. 3
0
 public override void onAddedToEntity()
 {
     _collider = entity.getComponent <Collider>();
     Insist.isNotNull(_collider, "null Collider. ProjectilMover requires a Collider!");
 }