From 5ee0bd7094035bb531457ef6ee6a4e7967bfe757 Mon Sep 17 00:00:00 2001 From: Victor Chelaru Date: Fri, 18 Aug 2023 22:24:45 -0600 Subject: [PATCH] Added ShapeCollection.ForceUpdateDependencies. --- .../Math/Geometry/ShapeCollectionSave.cs | 12 +++---- .../Math/Geometry/ShapeCollection.cs | 32 +++++++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Content/Math/Geometry/ShapeCollectionSave.cs b/Engines/FlatRedBallXNA/FlatRedBall/Content/Math/Geometry/ShapeCollectionSave.cs index a3be91ce3..91a152d5f 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall/Content/Math/Geometry/ShapeCollectionSave.cs +++ b/Engines/FlatRedBallXNA/FlatRedBall/Content/Math/Geometry/ShapeCollectionSave.cs @@ -203,13 +203,13 @@ public void SetValuesOn(ShapeCollection shapeCollection, PositionedObject newSha for (int i = 0; i < CircleSaves.Count; i++) { - CircleSave circle = this.CircleSaves[i]; + CircleSave circleSave = this.CircleSaves[i]; Circle match = null; for (int j = 0; j < shapeCollection.Circles.Count; j++) { var candidate = shapeCollection.Circles[j]; - if (candidate.Name == circle.Name) + if (candidate.Name == circleSave.Name) { match = candidate; break; @@ -228,10 +228,10 @@ public void SetValuesOn(ShapeCollection shapeCollection, PositionedObject newSha if(match != null) { - circle.SetValuesOn(match); - match.RelativeX = circle.X; - match.RelativeY = circle.Y; - match.RelativeZ = circle.Z; + circleSave.SetValuesOn(match); + match.RelativeX = circleSave.X; + match.RelativeY = circleSave.Y; + match.RelativeZ = circleSave.Z; } } diff --git a/Engines/FlatRedBallXNA/FlatRedBall/Math/Geometry/ShapeCollection.cs b/Engines/FlatRedBallXNA/FlatRedBall/Math/Geometry/ShapeCollection.cs index 02fa2443b..1c6026fac 100644 --- a/Engines/FlatRedBallXNA/FlatRedBall/Math/Geometry/ShapeCollection.cs +++ b/Engines/FlatRedBallXNA/FlatRedBall/Math/Geometry/ShapeCollection.cs @@ -872,6 +872,38 @@ public void UpdateDependencies(double currentTime) } } + public void ForceUpdateDependencies() + { + for (int i = 0; i < mAxisAlignedRectangles.Count; i++) + { + mAxisAlignedRectangles[i].ForceUpdateDependencies(); + } + for (int i = 0; i < mCircles.Count; i++) + { + mCircles[i].ForceUpdateDependencies(); + } + for (int i = 0; i < mPolygons.Count; i++) + { + mPolygons[i].ForceUpdateDependencies(); + } + for (int i = 0; i < mLines.Count; i++) + { + mLines[i].ForceUpdateDependencies(); + } + for (int i = 0; i < mSpheres.Count; i++) + { + mSpheres[i].ForceUpdateDependencies(); + } + for (int i = 0; i < mAxisAlignedCubes.Count; i++) + { + mAxisAlignedCubes[i].ForceUpdateDependencies(); + } + for (int i = 0; i < mCapsule2Ds.Count; i++) + { + mCapsule2Ds[i].ForceUpdateDependencies(); + } + } + public void FlipHorizontally() { #region Flip the AxisAlignedRectangles