private bool seesWall() { List<PhysicalObject2D> visionCollisions = World._mainCollisionDictionary.CalculateCollisions(VisionRectangle); foreach (PhysicalObject2D s in visionCollisions) { CollisionRectangle futureNpc = new CollisionRectangle(new Vector2(s.Position.X, Position.Y), new Vector2(Bounds.Width, Bounds.Height)); CollisionRectangle platformRectangle = s.Bounds; if (futureNpc.Intersects(platformRectangle) && (s.Position.Y < Bounds.Bottom)) { if (s is IColored && (((IColored)s).Color == Color || ((IColored)s).Color == Color.White)) if (s is Platform && s.Collidable == true) { return true; } } } return false; }
protected override void UpdateBounds() { List<VectorRectangle> childrenBounds = new List<VectorRectangle>(); foreach (PhysicalObject2D child in Children) { childrenBounds.Add(child.Bounds); } _bounds = new CollisionRectangle(VectorRectangle.GetUnion(childrenBounds)); _bounds.Object = this; _boundsChanged = false; // TODO shit }
public void Add(CollisionRectangle rectangle) { if (rectangle == null) throw new ArgumentException("Rectangle can't be null"); _allRectangles.Add(rectangle); }