public virtual object PlayAnimation(params object[] objs) { string animName = objs[0] as string; AMIN_MODEL model = AMIN_MODEL.DEFAULT; bool noReset = true; if (objs.Length >= 2) { model = (AMIN_MODEL)objs[1]; } if (objs.Length >= 3) { noReset = Convert.ToBoolean(objs[2]); } Owner.L_Anim_Name = animName; Owner.AnimModel = model; if (null == Owner.Anim) { return(false); } if (noReset && Owner.Anim.IsPlaying(animName)) { return(true); } StopAnim(); try { if (model == AMIN_MODEL.ONCE) { Owner.Anim[animName].wrapMode = WrapMode.ClampForever; } else if (model == AMIN_MODEL.LOOP) { Owner.Anim[animName].wrapMode = WrapMode.Loop; } }catch (NullReferenceException e) { } if (Owner.Anim.GetClip(animName)) { Owner.Anim.CrossFade(animName); } return(true); }
public override object CrossFadeAnimation(params object[] objs) { string animName = Convert.ToString(objs[0]); AMIN_MODEL model = AMIN_MODEL.DEFAULT; bool noReset = true; bool isFade = false; float fadeTime = 0; if (objs.Length == 3) { model = (AMIN_MODEL)objs[1]; noReset = Convert.ToBoolean(objs[2]); } else if (objs.Length == 2) { isFade = true; fadeTime = (float)objs[1]; } else if (objs.Length == 4) { isFade = true; fadeTime = (float)objs[3]; } //Debug.LogWarning("L_Anim_Name = " + Owner.L_Anim_Name); Owner.L_Anim_Name = animName; if (Owner.Anim && Owner.Anim.GetClip(animName) != null) { if (isFade) { return(base.CrossFadeAnimation(animName, model, noReset, fadeTime)); } else { return(base.CrossFadeAnimation(animName, model, noReset)); } } LoadRoleAnimAndPlay(Owner.property.roleType, animName); return(false); }
public virtual object CrossFadeAnimation(params object[] objs) { string animName = Convert.ToString(objs[0]); AMIN_MODEL model = AMIN_MODEL.DEFAULT; bool noReset = true; bool isFade = false; float fadeTime = 0; if (objs.Length == 3) { model = (AMIN_MODEL)objs[1]; noReset = Convert.ToBoolean(objs[2]); } else if (objs.Length == 2) { isFade = true; fadeTime = (float)objs[1]; } else if (objs.Length == 4) { isFade = true; fadeTime = (float)objs[3]; } Owner.L_Anim_Name = animName; Owner.AnimModel = model; if (null == Owner.Anim) { return(false); } if (noReset && Owner.Anim.IsPlaying(animName)) { return(true); } try { if (model == AMIN_MODEL.ONCE) { Owner.Anim[animName].wrapMode = WrapMode.Once; } else if (model == AMIN_MODEL.LOOP) { Owner.Anim[animName].wrapMode = WrapMode.Loop; } } catch (NullReferenceException e) { } if (Owner.Anim.GetClip(animName)) { if (isFade) { if (fadeTime < 0.01f) { Owner.Anim.Play(animName); } else { Owner.Anim.CrossFade(animName, fadeTime); } //Debug.LogWarning("CrossFade "+animName+" "+fadeTime); } else { //Debug.LogWarning("CrossFade "+animName+" "); Owner.Anim.CrossFade(animName); } } return(true); }