private void CheckEnvironmentTile(List <MapSquare> hitSquares, CollisionBox hitbox, RectangleF hitRect, MapSquare tile, ref PointF offset) { if (hitbox.EnvironmentCollisions(PositionSrc.Position, tile, ref offset)) { hitSquares.Add(tile); if (hitbox.PushAway) { PositionSrc.Offset(offset.X, offset.Y); } } else if (hitRect.IntersectsWith(tile.BoundBox)) { hitSquares.Add(tile); } }
protected override void Update() { aboveLadderCached = false; atTopCached = false; inReachCached = false; inReachTile = null; aboveTile = null; }
private void CheckInReach() { inReach = false; if (position == null) return; foreach (HitBox hitbox in hitboxes) { foreach (MapSquare tile in Parent.Screen.Tiles) { if (tile.Tile.Properties.Climbable) { RectangleF myBox = hitbox.BoxAt(position.Position, Parent.IsGravitySensitive ? Parent.Container.IsGravityFlipped : false); RectangleF intersection = RectangleF.Intersect(tile.BoundBox, myBox); if (!intersection.IsEmpty) { inReach = true; inReachTile = tile; inReachCached = true; reachRect = intersection; return; } } } } }
private void CheckEnvironmentTile(List<MapSquare> hitSquares, CollisionBox hitbox, RectangleF hitRect, MapSquare tile, ref PointF offset) { if (hitbox.EnvironmentCollisions(PositionSrc.Position, tile, ref offset)) { hitSquares.Add(tile); if (hitbox.PushAway) PositionSrc.Offset(offset.X, offset.Y); } else if (hitRect.IntersectsWith(tile.BoundBox)) { hitSquares.Add(tile); } }