public TimedActivity ( float secondDifference, double secondDifferenceSquaredDividedByTwo, float secondsPassedLastFrame ) : void | ||
secondDifference | float | |
secondDifferenceSquaredDividedByTwo | double | |
secondsPassedLastFrame | float | |
return | void |
public void Test2Objects() { var so = new SpriterObject("Global", false); var sprite = new ScaledSprite(); var pivot = new ScaledPositionedObject(); var sprite2 = new ScaledSprite(); var pivot2 = new ScaledPositionedObject(); pivot.AttachTo(so, true); sprite.AttachTo(pivot, true); pivot2.AttachTo(so, true); sprite2.AttachTo(pivot2, true); so.Animations.Add("", new SpriterObjectAnimation("", true, 2.0f, new List<KeyFrame>())); var keyFrame = new KeyFrame { Time = 0 }; keyFrame.Values[pivot] = new KeyFrameValues { RelativePosition = Vector3.Zero }; keyFrame.Values[pivot2] = new KeyFrameValues { RelativePosition = Vector3.Zero }; so.Animations[""].KeyFrames.Add(keyFrame); keyFrame = new KeyFrame { Time = 1.0f }; keyFrame.Values[pivot] = new KeyFrameValues { RelativePosition = new Vector3(0f, 10f, 0f) }; keyFrame.Values[pivot2] = new KeyFrameValues { RelativePosition = new Vector3(10f, 0f, 0f) }; so.Animations[""].KeyFrames.Add(keyFrame); so.ObjectList.Add(sprite); so.ObjectList.Add(pivot); so.ObjectList.Add(sprite2); so.ObjectList.Add(pivot2); so.StartAnimation(); TimeManager.CurrentTime += .5; so.TimedActivity(.5f, 0f, 0f); Assert.AreEqual(5f, so.ObjectList[1].Position.Y); Assert.AreEqual(5f, so.ObjectList[3].Position.X); TimeManager.CurrentTime += .25; so.TimedActivity(.25f, 0f, 0f); Assert.AreEqual(7.5f, so.ObjectList[1].Position.Y); Assert.AreEqual(7.5f, so.ObjectList[3].Position.X); }
public void BoneReparenting() { var so = new SpriterObject("Global", false); var bone1 = new ScaledPositionedObject(); var bone2 = new ScaledPositionedObject(); so.Animations.Add("", new SpriterObjectAnimation("", false, 2.0f, new List<KeyFrame>())); var keyFrame = new KeyFrame { Time = 0f }; keyFrame.Values[bone1] = new KeyFrameValues { Parent = so }; keyFrame.Values[bone2] = new KeyFrameValues { Parent = bone1 }; so.Animations[""].KeyFrames.Add(keyFrame); keyFrame = new KeyFrame { Time = 1.0f }; keyFrame.Values[bone1] = new KeyFrameValues { RelativePosition = new Vector3(100f, 0f, 0f), Parent = so }; keyFrame.Values[bone2] = new KeyFrameValues { Parent = so }; so.Animations[""].KeyFrames.Add(keyFrame); so.ObjectList.Add(bone1); so.ObjectList.Add(bone2); so.StartAnimation(); so.TimedActivity(.5f, 0f, 0f); Assert.AreSame(so.ObjectList[0], so.ObjectList[1].Parent); Assert.AreSame(so, so.ObjectList[0].Parent); so.TimedActivity(.5f, 0f, 0f); Assert.AreSame(so, so.ObjectList[1].Parent); Assert.AreSame(so, so.ObjectList[0].Parent); }