public void Init(Animator animator) { _renderers = _propRoot.GetComponentsInChildren <Renderer>(); if (_animClip != null) { _animation = _propRoot.gameObject.GetComponent <Animation>(); if (_animation == null) { _animation = _propRoot.gameObject.AddComponent <Animation>(); } if (!_animation.GetClip(_animClip.name)) { _animation.AddClip(_animClip, _animClip.name); } } if (_attachToBone) { Transform attachment = MoveEditor.MoveUtils.GetBodyPartTransform(animator, _attachment); _propRoot.position = attachment.position; _propRoot.rotation = attachment.rotation; AttachTransform.Attach(_propRoot.gameObject, attachment); } }
public static GameObject InstantiateDynamicLight(DynamicLightEventProperties properties, Animator animator, bool flipped, bool bypassPools = false) { GameObject light = null; if (Application.isPlaying) { if (!bypassPools) { light = LoadLightWithPool(properties); } else { light = LoadLightWithoutPool(properties); } } else { light = LoadLightWithoutPool(properties); } if (light != null) { //DynamicPointLightInstance lightInstance = light.GetComponent<DynamicPointLightInstance>(); if (animator != null) { light.transform.parent = GetBodyPartTransform(animator, properties._attachment, properties._attachmentPath); light.transform.localPosition = properties._offset; } if (properties._parent) { AttachTransform.Attach(light, light.transform.parent, flipped, false); } } return(light); }