internal override void OnTrigger() { base.OnTrigger(); GOEActorEntity act = this.Entity as GOEActorEntity; bool has1 = !string.IsNullOrEmpty(Animation1); bool has2 = !string.IsNullOrEmpty(Animation2); bool has3 = !string.IsNullOrEmpty(Animation3); if (EntityAct.ActSpeed != 1) { act.AnimationSpeed = EntityAct.ActSpeed; } if (has1) { //只与部分动作融合(跑步) if (IsAnimationBlend && act.CheckBlendAnim()) { if (act.PlayBlend(Animation1, BlendWeight, act.BlendPoint)) { bBlend = true; } } else { act.Stop(); if (!has2) { act.CrossFade(Animation1, crossfadeTime, PlayMode.StopSameLayer, !DoNotReturnToStand); } else { act.CrossFade(Animation1, crossfadeTime, PlayMode.StopSameLayer, false); } } } if (has2) { if (!has3) { act.PlayQueued(Animation2, QueueMode.CompleteOthers, PlayMode.StopSameLayer, !DoNotReturnToStand); } else { act.PlayQueued(Animation2); } } if (has3) { act.PlayQueued(Animation3, QueueMode.CompleteOthers, PlayMode.StopSameLayer, !DoNotReturnToStand); } if (IsNextAnimationNoCrossfade) { act.NextAnimationNoCrossfade = true; } this.Enable = false; }
public bool CrossFade(string name, float fadeLength = 0.3F, PlayMode mode = PlayMode.StopSameLayer, bool backToStand = true) { if (nextAnimNoCrossFade) { nextAnimNoCrossFade = false; PlayAnimation(name, mode, backToStand); return(true); } if (this.GameObject == null || animation == null || string.IsNullOrEmpty(name)) { return(false); } name = GetAniName(name); AnimationClip animClip = animation.GetClip(name); if (animClip == null) { _waitAni = name; string animName = name + ANIM_SUFFIX; GOERoot.ResMgrImp.GetAsset(animName, (string cbName, UnityEngine.Object cbObject) => { OnLoadAnim(name, cbObject); if (_waitAni == name) { _CrossFade(name, fadeLength, mode, backToStand); } }); } else { _CrossFade(name, fadeLength, mode, backToStand); } foreach (Entity ent in mAttaches) { if (ent is GOEActorEntity) { GOEActorEntity ae = ent as GOEActorEntity; if (!ae.IsVirtual) { continue; } ae.CrossFade(name, fadeLength, mode, backToStand); } } return(true); }