Example #1
0
    IEnumerator Coroutine_PlayEffect(string effectName, float effectTime, string posByBone, bool isAdhered, Vector3 offset, bool isAddToAttackAction = false)
    {
        GameResPackage.AsyncLoadObjectData data = new GameResPackage.AsyncLoadObjectData();
        IEnumerator e = PoolManager.Singleton.Coroutine_Load(GameData.GetEffectPath(effectName), data);

        while (true)
        {
            e.MoveNext();
            if (data.m_isFinish)
            {
                break;
            }
            yield return(e.Current);
        }
        if (data.m_obj != null)
        {
            PlayEffect(data.m_obj as GameObject, effectTime, posByBone, isAdhered, offset);
            if (isAddToAttackAction)
            {
                if (ActionControl.IsActionRunning(ActorAction.ENType.enAttackAction))
                {
                    TrapAttackAction action = this.mActionControl.LookupAction(TrapAction.ENType.enAttackAction) as TrapAttackAction;
                    action.AddEffectObj(data.m_obj as GameObject);
                }
            }
        }
        else
        {
            TrapAttackAction action = mActionControl.LookupAction(TrapAttackAction.SGetActionType()) as TrapAttackAction;
            if (action != null)
            {
                Debug.LogWarning("Play effect fail, actorID:" + ID + ",effectName:" + effectName);
            }
            else
            {
                Debug.LogWarning("Play effect fail, name:" + effectName);
            }
        }
    }