private void Load(BoneFxClipData data) { var root = track.root; XBindTrack bt = root as XBindTrack; var seed = data.seed; if (bt) { var go = bt.bindObj; if (go != null && !string.IsNullOrEmpty(data.bone)) { var tf = go.transform.Find(data.bone); fx = XResources.LoadGameObject(data.prefab); fx.SetActive(false); path = data.prefab; if (fx) { fx.transform.parent = tf; fx.transform.localPosition = data.pos; fx.transform.localRotation = Quaternion.Euler(data.rot); fx.transform.localScale = data.scale; ps = fx.GetComponentsInChildren <ParticleSystem>(); for (int i = 0; i < ps.Length; i++) { ps[i].randomSeed = seed; ps[i].Stop(); } } } } }
public void Load(string path, Vector3 pos, Vector3 rot, Vector3 scale) { this.path = path; prefabGameObject = XResources.LoadGameObject(path); if (prefabGameObject != null) { seqence.BindGo(prefabGameObject); var tf = prefabGameObject.transform; tf.position = pos; tf.rotation = Quaternion.Euler(rot); tf.localScale = scale; particleSystems = tf.GetComponentsInChildren <ParticleSystem>(); } }
private void Rebind(string prefab) { if (!string.IsNullOrEmpty(prefab) && bindObj == null) { pat = prefab; GameObject obj = null; if (seqence.IsHostTrack(this) && seqence.hostAnimator != null) { obj = seqence.hostAnimator.gameObject; } else { obj = XResources.LoadGameObject(prefab); } if (obj) { bindObj = obj; seqence.BindGo(bindObj); (data as BindTrackData).prefab = prefab; //childs & self ForeachHierachyTrack(x => x.OnBind()); } } }