Skip to main content

AnimatedValue<T>

An abstract class in Root.Township, Alta.Networking.Animation.

Base for one synced animator parameter (bool, float, trigger) on a NetworkAnimator. A change is resent in the next several syncs so it gets through. Get one from the animator with GetBool, GetFloat or GetTrigger.

Constructors​

MemberWhat it is
AnimatedValue(string name)Creates an AnimatedValue from name.

Fields​

MemberWhat it is
protected T valueBacking field for Value.
3 private and internal fields
MemberWhat it is
private NetworkAnimator animatorThe NetworkAnimator that owns this value.
private int indexThis value's position in the animator's list of values.
private string nameThe animator parameter name.

Properties​

MemberWhat it is
NetworkAnimator Animator { get; }The network animator this value belongs to.
int Changed { get; set; }How many more syncs will include this value. Counts down to 0.
virtual int ChangedCounter { get; }How many syncs a change is sent in (10 by default).
virtual string GUIName { get; }Name and current value, for debug display.
int Index { get; }Index of the parameter in the animator.
string Name { get; }Animator parameter name.
virtual T Value { get; set; }The current value. Setting a different value marks it changed and applies it.

Methods​

MemberWhat it is
virtual void GUI()Debug GUI hook. Does nothing by default.
virtual void Initialize(NetworkAnimator animator, int index)Links the value to its animator and index.
virtual void Serialize(Stream stream, bool isWriteFull)Writes or reads a flag and, if set (changed or full write), the value itself.
protected abstract void Serialize(Stream stream)Writes or reads a flag and, if set (changed or full write), the value itself.
protected abstract void Update()Applies the value to the local animator. Implement in subclasses.