Пример #1
0
    public void CreateSkillEffect()
    {
        uint count = m_skillEffectData.Number;

        if (count <= 0)
        {
            return;
        }

        bool hasInit = count == m_lstSkillList.Count;

        float   startShowTime = 0;
        Vector2 startPos      = (Vector2)m_owner.Transform.position + m_startPosOffset;

        for (int i = 0; i < count; i++)
        {
            if (!hasInit)
            {
                SkillEffect skillEffect = new SkillEffect(m_skillEffectData);
                m_lstSkillList.Add(skillEffect);
                skillEffect.Initialize(startShowTime, startPos, m_owner.Direction, m_loadObj, m_rootTrans, m_owner);
            }
            else
            {
                m_lstSkillList[i].Initialize(startShowTime, startPos, m_owner.Direction, m_loadObj, m_rootTrans, m_owner);
            }

            startShowTime += m_skillEffectData.CreatDeltaTime;
            startPos      += m_createPosOffset;
        }
    }
Пример #2
0
    /// <summary>
    /// 根据参数, 创建技能效果, 并使之开始运行.
    /// </summary>
    /// <returns></returns>
    public ErrorCode CreateSkillEffect(SkillEffectInitParam param)
    {
        SkillEffect effect = SkillDetails.AllocSkillEffect(param);

        if (effect == null)
        {
            return(ErrorCode.InvalidParam);
        }

        if (!effect.Initialize(param))
        {
            return(ErrorCode.LogicError);
        }

        ErrorCode err = effect.Start(param);

        if (err == ErrorCode.Succeeded)
        {
            if (effect.NeedUpdate)
            {
                mContainer.Add(effect as SkillBuff);
            }
            else
            {
                effect.Stop(SkillEffectStopReason.Expired);
            }
        }

        return(err);
    }