Ejemplo n.º 1
0
    /// <summary>
    /// 开始进入爆炸倒计时.
    /// </summary>
    private void explodeCountBackwards(object param)
    {
        if (!mAwake)
        {
            return;
        }

        RemoveSkillBuffByResID(mTrapResource.buffID);

        if (mTrapResource.delayEffect != uint.MaxValue)
        {
            if (mTrapResource.loopDelayEffect)
            {
                mLoopClientBehaviours = new ClientBehaviourIdContainer();
            }

            SkillClientBehaviour.AddEffect2Object(this,
                                                  mTrapResource.delayEffect,
                                                  mTrapResource.delayEffectBindpoint,
                                                  GetDirection(),
                                                  mTrapResource.loopDelayEffect,
                                                  mLoopClientBehaviours
                                                  );
        }

        mAwake = false;
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 播放声音.
 /// </summary>
 public static void PlaySound(uint soundId, bool loop = false, ClientBehaviourIdContainer cont = null)
 {
     if (soundId != uint.MaxValue)
     {
         uint runtimeID = (uint)SoundManager.Instance.Play((int)soundId, null, loop);
         if (loop && cont != null)
         {
             cont.soundId = runtimeID;
         }
     }
 }
Ejemplo n.º 3
0
    /// <summary>
    /// 根据存储的ID, 移除所有前端表现.
    /// </summary>
    public static void RemoveAll(BattleUnit owner, ClientBehaviourIdContainer identifiers)
    {
        if (identifiers.roleAnimationHashCode != 0)
        {
            owner.GetStateController().FinishCurrentState(identifiers.roleAnimationHashCode);
        }

        if (identifiers.soundId != uint.MaxValue)
        {
            SoundManager.Instance.RemoveSoundByID((int)identifiers.soundId);
        }

        if (identifiers.threeDEffect2Role_0 != uint.MaxValue)
        {
            owner.RemoveEffect(identifiers.threeDEffect2Role_0);
        }

        if (identifiers.threeDEffect2Role_1 != uint.MaxValue)
        {
            owner.RemoveEffect(identifiers.threeDEffect2Role_1);
        }

        if (identifiers.threeDEffectInScene != uint.MaxValue)
        {
            BaseScene scn = SceneManager.Instance.GetCurScene();
            if (scn != null)
            {
                scn.RemoveEffect(identifiers.threeDEffectInScene);
            }
        }

        if (identifiers.weaponAnimation != uint.MaxValue)
        {
            owner.PlayWeaponAnim(AnimationNameDef.WeaponDefault);
        }

        identifiers.Clear();
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 给单位添加特效.
    /// </summary>
    public static void AddEffect2Object(BattleUnit owner, uint effectID, string bindpoint, float dir = float.NaN, bool loop = false, ClientBehaviourIdContainer cont = null)
    {
        uint runtimeID = uint.MaxValue;

        if (effectID != uint.MaxValue)
        {
            runtimeID = owner.AddEffect(effectID, bindpoint, dir);
            if (runtimeID == uint.MaxValue)
            {
                ErrorHandler.Parse(ErrorCode.ConfigError, "添加特效" + effectID + "失败");
            }
        }

        EffectTableItem eti = DataManager.EffectTable[effectID] as EffectTableItem;


        if (eti != null && eti.loop && cont != null)
        {
            if (cont.threeDEffect2Role_0 == uint.MaxValue)
            {
                cont.threeDEffect2Role_0 = runtimeID;
            }
            else
            {
                cont.threeDEffect2Role_1 = runtimeID;
            }
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 播放场景特效.
    /// </summary>
    public static void AddSceneEffect(uint effectID, Vector3 position, float dir = float.NaN, bool loop = false, ClientBehaviourIdContainer cont = null)
    {
        uint      runtimeID = uint.MaxValue;
        BaseScene scn       = SceneManager.Instance.GetCurScene();

        if (scn != null && effectID != uint.MaxValue)
        {
            runtimeID = scn.CreateEffect((int)effectID, Vector3.one, position, dir, null, !loop);
            if (runtimeID == uint.MaxValue)
            {
                ErrorHandler.Parse(ErrorCode.ConfigError, "添加特效" + effectID + "失败");
            }
        }

        EffectTableItem eti = DataManager.EffectTable[effectID] as EffectTableItem;

        if (eti != null && eti.loop && cont != null)
        {
            cont.threeDEffectInScene = runtimeID;
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 播放武器动画.
    /// </summary>
    public static void PlayWeaponAnimation(BattleUnit owner, string aniName, bool loop = false, ClientBehaviourIdContainer cont = null)
    {
        if (!string.IsNullOrEmpty(aniName))
        {
            AnimActionUseSkill skillAction = AnimActionFactory.Create(AnimActionFactory.E_Type.UseSkill) as AnimActionUseSkill;
            skillAction.loop = loop;
            owner.PlayWeaponAnim(AnimationNameDef.WeaponPrefix + aniName);

            if (cont != null)
            {
                cont.weaponAnimation = 1;
            }
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// 播放动画.
    /// </summary>
    public static void PlayAnimation(BattleUnit owner, string aniName, bool loop = false, ClientBehaviourIdContainer cont = null)
    {
        if (cont != null && cont.roleAnimationHashCode != 0)
        {
            owner.GetStateController().FinishCurrentState(cont.roleAnimationHashCode);
            cont.roleAnimationHashCode = 0;
        }

        if (!string.IsNullOrEmpty(aniName))
        {
            string animationName = owner.CombineAnimname(aniName);
            int    hashCode      = 0;
            if (owner.GetStateController().AnimSet != null)
            {
                hashCode = owner.GetStateController().AnimSet.GetStateHash(animationName);
            }

            if (hashCode != 0)
            {
                AnimActionUseSkill skillAction = AnimActionFactory.Create(AnimActionFactory.E_Type.UseSkill) as AnimActionUseSkill;
                skillAction.AnimName = animationName;

                skillAction.loop = loop;
                owner.GetStateController().DoAction(skillAction);

                // 动作无论循环与否, 都保存ID.
                if (cont != null)
                {
                    cont.roleAnimationHashCode = hashCode;
                }
            }
        }
    }