/// <summary> /// Creates a Rotater. This removes any existing nlerpers and rotaters attached to the lthing. /// </summary> /// <param name="owner">What lthing are we affecting?</param> /// <param name="duration">How long as we going to rotate?</param> /// <param name="angle">Rotation angle</param> /// <param name="mode">Rotation axis mode</param> /// <returns>The new rotater</returns> public Rotater CreateRotater(LThing owner, float duration, Radian angle, RotaterAxisMode mode) { RemoveRotater(owner); Rotater newRotater = new Rotater(owner, duration, angle, mode); Rotaters.TryAdd(owner, newRotater); return newRotater; }
/// <summary> /// Creates a Rotater. This removes any existing nlerpers and rotaters attached to the lthing. /// </summary> /// <param name="owner">What lthing are we affecting?</param> /// <param name="duration">How long as we going to rotate?</param> /// <param name="angle">Rotation angle</param> /// <param name="axis">Axis of rotation</param> /// <param name="mode">Rotation axis mode</param> /// <returns>The new rotater</returns> public Rotater CreateRotater(LThing owner, float duration, Radian angle, Vector3 axis, RotaterAxisMode mode = RotaterAxisMode.Explicit) { RemoveRotater(owner); RemoveNlerper(owner); Rotater newRotater = new Rotater(owner, duration, angle, axis, mode); Rotaters.TryAdd(owner, newRotater); return newRotater; }
/// <summary> /// Cleans up a rotater when it's finished /// </summary> void Rotater_Finished(Rotater rotater, LThing thing) { if (Rotaters.Values.Contains(rotater)) { Rotater existing; Rotaters.TryRemove(thing, out existing); } }
/// <summary> /// Removes a rotater but checks that the given rotater is still in our dictionary. /// </summary> public void Remove(Rotater rotater) { if (Rotaters.Values.Contains(rotater)) { RemoveRotater(rotater.Owner); } }