FlatRedBallExtensions.ScaledPositionedObject.UpdateDependencies C# (CSharp) Метод

UpdateDependencies() публичный Метод

public UpdateDependencies ( double currentTime ) : void
currentTime double
Результат void
        public override void UpdateDependencies(double currentTime)
        {
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            lock (this)
            {
                if (mLastDependencyUpdate == currentTime)
                {
                    return;
                }
                mLastDependencyUpdate = currentTime;
            }

            this.UpdateDependenciesHelper(currentTime);
        }

Usage Example

        public void RelativeRotationScaledPositionTest()
        {
            var parent1 = new ScaledPositionedObject
            {
                Position = new Vector3(100f, 100f, 100f)
            };

            var parent2 = new ScaledPositionedObject
            {
                RelativeScaleX = .5f,
                Position = new Vector3(100f, 100f, 100f)
            };

            var spo = new ScaledPositionedObject();
            parent2.AttachTo(parent1, true);
            spo.AttachTo(parent2, true);

            spo.RelativePosition = new Vector3(10f, 10f, 0f);
            parent2.RelativeRotationZ = MathHelper.ToRadians(90f);
            parent1.RotationZ += MathHelper.ToRadians(90f);

            spo.UpdateDependencies(1);

            var rotationZ = MathHelper.ToDegrees(spo.RotationZ);
            Assert.IsTrue(Math.Abs(rotationZ - 180f) < .0001f);
            Assert.IsTrue(Math.Abs(spo.Position.X - 95f) < .0001f);
            Assert.IsTrue(Math.Abs(spo.Position.Y - 90f) < .0001f);
        }
All Usage Examples Of FlatRedBallExtensions.ScaledPositionedObject::UpdateDependencies