Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
PhysicsElementDataConverter.cs
Go to the documentation of this file.
1 namespace SiliconStudio.Paradox.Physics
2 {
3  /// <summary>
4  /// Converter type for <see cref="PhysicsElement"/>.
5  /// </summary>
6  public class PhysicsElementDataConverter : Core.Serialization.Converters.DataConverter<PhysicsElementData, PhysicsElement>
7  {
8  /// <inheritdoc/>
9  public override void ConvertToData(Core.Serialization.Converters.ConverterContext context, ref PhysicsElementData target, PhysicsElement source)
10  {
11  target = new PhysicsElementData { Type = source.Type, LinkedBoneName = source.LinkedBoneName };
12  context.ConvertToData(ref target.Shape, source.Shape);
13  target.CollisionGroup = source.CollisionGroup;
14  target.CanCollideWith = source.CanCollideWith;
15  target.StepHeight = source.StepHeight;
16  target.Sprite = source.Sprite;
17  }
18 
19  /// <inheritdoc/>
20  public override void ConvertFromData(Core.Serialization.Converters.ConverterContext context, PhysicsElementData target, ref PhysicsElement source)
21  {
22  source = new PhysicsElement { Type = target.Type, LinkedBoneName = target.LinkedBoneName };
23  {
24  var temp = source.Shape;
25  context.ConvertFromData(target.Shape, ref temp);
26  source.Shape = temp;
27  }
28  source.CollisionGroup = target.CollisionGroup;
29  source.CanCollideWith = target.CanCollideWith;
30  source.StepHeight = target.StepHeight;
31  source.Sprite = target.Sprite;
32  }
33  }
34 }
override void ConvertFromData(Core.Serialization.Converters.ConverterContext context, PhysicsElementData target, ref PhysicsElement source)
override void ConvertToData(Core.Serialization.Converters.ConverterContext context, ref PhysicsElementData target, PhysicsElement source)
using SiliconStudio.Paradox. Physics