bool DrawGroup(AniFxGroup g, AniFxMgr aniFxMgr, Animation ani, string[] aniNames) { //绘制 bool isShow; bool isClick; int idxOld = Array.IndexOf(aniNames, g.name); if (idxOld == -1) { using (new AutoChangeColor(Color.red)) EditorUtil.DrawHeaderBtn(g.name + "(动作找不到)", "删除", out isShow, out isClick); } else { AnimationState st = ani[g.name]; int maxFrame = (int)(st.length / Util.One_Frame); EditorUtil.DrawHeaderBtn(string.Format("{0}(共{1}帧)", g.name, maxFrame), "删除", out isShow, out isClick); } List <AniFx> removes = new List <AniFx>(); if (isShow) { using (new AutoContent()){ foreach (AniFx fx in g.fxs) { if (DrawFx(fx, g, aniFxMgr, ani, aniNames)) { removes.Add(fx); } } //添加 if (GUILayout.Button("添加")) { AniFx fx = new AniFx(); fx.follow = true; fx.destroyIfAniEnd = true; fx.endFrame = -1; g.fxs.Add(fx); } #if ART_DEBUG if (Application.isPlaying && GUILayout.Button("播放")) { SimpleRole.AttackCxt atk = new SimpleRole.AttackCxt(); atk.aniName = g.name; aniFxMgr.transform.parent.GetComponent <SimpleRole>().GotoState(SimpleRole.enState.attack, atk); } #endif } } else { foreach (AniFx fx in g.fxs) { if (fx.IsDrawGizmos) { fx.IsDrawGizmos = false; } } } //删除 foreach (AniFx fx in removes) { g.fxs.Remove(fx); } return(isClick); }
//进入这个状态的时候 public override void OnEnter(SimpleRole.enState lastState, object param) { m_curCxt = (SimpleRole.AttackCxt)param; m_parent.Ani.Play(m_curCxt.aniName, m_curCxt.wrapMode, 0); }
public void DrawAtk(string title, SimpleRole r, SimpleRole.AttackCxt c, Animation ani, string[] aniNames) { if (EditorUtil.DrawHeader(string.Format("{0}:{1}", title, c.aniName))) { using (new AutoContent()) { int idxOld = Array.IndexOf(aniNames, c.aniName); if (idxOld == -1 && !string.IsNullOrEmpty(c.aniName)) { c.aniName = ""; } int idx = UnityEditor.EditorGUILayout.Popup("动作名", idxOld, aniNames); if (idx != idxOld) { c.aniName = aniNames[idx]; } AnimationState aniSt = ani[c.aniName]; if (aniSt == null) { EditorGUILayout.LabelField("无动作"); return; } c.wrapMode = (WrapMode)EditorGUILayout.EnumPopup("循环模式", c.wrapMode); //不用clamp,强制切到ClampForever if (c.wrapMode == WrapMode.Clamp) { c.wrapMode = WrapMode.ClampForever; } //持续时间 if (c.wrapMode == WrapMode.Loop || c.wrapMode == WrapMode.ClampForever || c.wrapMode == WrapMode.PingPong) { c.duration = EditorGUILayout.FloatField("持续时间", c.duration); } else { if (c.duration > 0) { c.duration = 0; } } //旋转 c.canRotate = EditorGUILayout.Toggle("可旋转", c.canRotate); if (c.canRotate) { c.rotateSpeed = EditorGUILayout.FloatField("旋转速度", c.rotateSpeed); } //移动 c.canMove = EditorGUILayout.Toggle("可移动", c.canMove); if (c.canMove) { c.moveSpeed = EditorGUILayout.FloatField("移动速度", c.moveSpeed); } } } }