Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public WorldBoundingBoxComponent(WorldEntity entity, Vector2 location, Rectangle baseRect) : base(entity)
        {
            //_box = (CollisionBoundingBox)CollisionGeometryFactory.CreateGeometry(CollisionType.BoundingBox);
            _box = new CollisionBoundingBox(location, baseRect);

            Geometry = _box;

            RaiseCreated();
        }
Esempio n. 4
0
        public void TeleportTo(Vector2 pos)
        {
            LastPos = Pos = pos;

            BoundingBox = CollisionBoundingBox.Offset(Pos - Vector2.UnitX * CollisionBoundingBox.Size.X / 2 - Vector2.UnitY * CollisionBoundingBox.Size.Y / 2);
        }
Esempio n. 5
0
 private void GenerateWallTileCollisionBox(Vector2 vec, Rectangle rect)
 {
     CollisionBoundingBox box  = new CollisionBoundingBox(vec, rect, 1, 1);
     CollisionComponent   comp = new WorldBoundingBoxComponent(new WallTileEntity(), box);
 }
Esempio n. 6
0
        public void TeleportTo(Vector3 pos)
        {
            Pos = LastPos = pos;

            BoundingBox = CollisionBoundingBox.Offset(pos - Vector3.UnitX * CollisionBoundingBox.Size.X / 2 - Vector3.UnitZ * CollisionBoundingBox.Size.Z / 2);
        }
Esempio n. 7
0
 public WorldBoundingBoxComponent(WorldEntity entity, CollisionBoundingBox box) : base(entity)
 {
     _box     = box;
     Geometry = box;
     RaiseCreated();
 }