protected Entity(World world, Vector3 pos, Vector3 motion = new Vector3()) { World = world; Pos = LastPos = pos; Motion = motion; CollisionBoundingBox = AxisAlignedBb.BlockFull; BoundingBox = CollisionBoundingBox.Offset(pos - CollisionBoundingBox.Size / 2); }
private void CreateCollisionBoundingBox() { // Create bounding box with 4 pixel barrier CollisionBoundingBox box = new CollisionBoundingBox(WorldLocation, _baseSprite.WorldRectangle, 4, 4); CollisionComponent comp = new WorldBoundingBoxComponent(this, box); comp.CollisionDetected += CollisionDetected; Components.Add(comp); }
public WorldBoundingBoxComponent(WorldEntity entity, Vector2 location, Rectangle baseRect) : base(entity) { //_box = (CollisionBoundingBox)CollisionGeometryFactory.CreateGeometry(CollisionType.BoundingBox); _box = new CollisionBoundingBox(location, baseRect); Geometry = _box; RaiseCreated(); }
public void TeleportTo(Vector2 pos) { LastPos = Pos = pos; BoundingBox = CollisionBoundingBox.Offset(Pos - Vector2.UnitX * CollisionBoundingBox.Size.X / 2 - Vector2.UnitY * CollisionBoundingBox.Size.Y / 2); }
private void GenerateWallTileCollisionBox(Vector2 vec, Rectangle rect) { CollisionBoundingBox box = new CollisionBoundingBox(vec, rect, 1, 1); CollisionComponent comp = new WorldBoundingBoxComponent(new WallTileEntity(), box); }
public void TeleportTo(Vector3 pos) { Pos = LastPos = pos; BoundingBox = CollisionBoundingBox.Offset(pos - Vector3.UnitX * CollisionBoundingBox.Size.X / 2 - Vector3.UnitZ * CollisionBoundingBox.Size.Z / 2); }
public WorldBoundingBoxComponent(WorldEntity entity, CollisionBoundingBox box) : base(entity) { _box = box; Geometry = box; RaiseCreated(); }