Beispiel #1
0
        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;
        }
Beispiel #2
0
        public void PlayQueued(string name, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer, bool backToStand = false)
        {
            if (this.GameObject == null || animation == null || string.IsNullOrEmpty(name))
            {
                return;
            }
            name = GetAniName(name);
            if (this.ResStatus != ResStatus.OK)
            {
                return;
            }
            foreach (Entity ent in mAttaches)
            {
                if (ent is GOEActorEntity)
                {
                    GOEActorEntity ae = ent as GOEActorEntity;
                    if (!ae.IsVirtual)
                    {
                        continue;
                    }
                    ae.PlayQueued(name, queue, mode, backToStand);
                }
            }
            AnimationClip animClip = animation.GetClip(name);

            if (animClip == null)
            {
                string animName = name + ANIM_SUFFIX;
                GOERoot.ResMgrImp.GetAsset(animName, (string cbName, UnityEngine.Object cbObject) =>
                {
                    OnLoadAnim(name, cbObject);
                });
                return;
                //Debug.LogError("CrossFadeQueued must make sure that the animation clip is on the character, animation is -> " + name);
            }
            animation.PlayQueued(name, queue, mode);
            setAniSpeed(name);
            appendStand(backToStand);
        }