protected override void Init(MyObjectBuilder_DefinitionBase def) { base.Init(def); var ob = (MyObjectBuilder_RailSwitchExternalComponentDefinition)def; _layers.Clear(); if (ob.Layers != null) { foreach (var lay in ob.Layers) { _layers.Add(lay); } } MaxAttachmentDistance = ob.MaxAttachmentDistance ?? 1f; MaxAttachmentDistanceSq = MaxAttachmentDistance * MaxAttachmentDistance; ControllerLocation = ob.ControllerLocation ?? Vector3.Zero; AllowDynamic = ob.AllowDynamic ?? false; Animators.Clear(); if (ob.Animators != null) { foreach (var k in ob.Animators) { Animators.Add(new ImmutableAnimator(k)); } } }
void IState.SetAnimator(UnityEngine.Animator animator) { Animators.Clear(); Animators.Add(animator); }