// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik // using System.Text; namespace Animancer { /// An and its . /// https://kybernetik.com.au/animancer/api/Animancer/NodeWeight public readonly struct NodeWeight { /************************************************************************************************************************/ /// The . public readonly AnimancerNode Node; /// The from when this struct was captured. public readonly float StartingWeight; /************************************************************************************************************************/ /// Creates a new . public NodeWeight(AnimancerNode node) { Node = node; StartingWeight = node.Weight; } /************************************************************************************************************************/ /// Creates a new . public NodeWeight(AnimancerNode node, float startingWeight) { Node = node; StartingWeight = startingWeight; } /************************************************************************************************************************/ /// Creates a copy of `copyFrom`. public NodeWeight(NodeWeight copyFrom, CloneContext context) { Node = context.GetOrCreateCloneOrOriginal(copyFrom.Node); StartingWeight = copyFrom.StartingWeight; } /************************************************************************************************************************/ /// Appends a detailed descrption of this object. public void AppendDescription(StringBuilder text, float targetWeight) { if (Node == null) { text.Append("Null: ") .Append(StartingWeight) .Append(" -> ") .Append(targetWeight); } else { text.Append(Node.GetPath()) .Append(": ") .Append(StartingWeight) .Append(" -> ") .Append(Node.Weight) .Append(" -> ") .Append(targetWeight); } } /************************************************************************************************************************/ } }