Beispiel #1
0
 private FxManager()
 {
     for (int i = 0; i < MAX_COUNT; i++)
     {
         FxShell shell = new FxShell();
         m_fxPool.Add(shell);
     }
 }
Beispiel #2
0
    public int PlayLink(string path, Transform oriTrans, Transform tarTrans, float during)
    {
        if (string.IsNullOrEmpty(path))
        {
            Debug.LogWarning("res neednot be null...");
            return(-1);
        }
        if (oriTrans == null || tarTrans == null)
        {
            Debug.LogWarning("trans neednot be null...");
            return(-1);
        }
        FxShell shell = _findAFreeShell();

        if (shell == null)
        {
            Debug.LogWarning("cant find a free fx...");
            return(-1);
        }

        var resShell = CacheCenter.Instance().GetResShell(path);

        if (resShell == null)
        {
            Debug.LogWarning("cant find a fx named : " + path);
            return(-1);
        }

        s_ID++;
        shell.res    = resShell.res;
        shell.during = during;
        shell.active = true;
        shell.id     = s_ID;

        if (during <= 0)
        {
            shell.loop = true;
        }

        return(s_ID++);
    }
Beispiel #3
0
    public int PlayAtPos(string path, Vector3 pos, Quaternion rot, float during)
    {
        if (string.IsNullOrEmpty(path))
        {
            Debug.LogWarning("res neednot be null...");
            return(-1);
        }
        FxShell shell = _findAFreeShell();

        if (shell == null)
        {
            Debug.LogWarning("cant find a free fx...");
            return(-1);
        }
        var res = CacheCenter.Instance().GetRes(path);

        if (res == null)
        {
            Debug.LogWarning("cant find a fx named : " + path);
            return(-1);
        }

        res.transform.position   = pos;
        res.transform.rotation   = Quaternion.identity;
        res.transform.localScale = Vector3.one;

        s_ID++;
        shell.res    = res;
        shell.during = during;
        shell.active = true;
        shell.id     = s_ID;
        if (during <= 0)
        {
            shell.loop = true;
        }

        return(s_ID);
    }
Beispiel #4
0
    public int PlayAsChild(string path, Transform trans, Vector3 localPos, Quaternion localRot, float during, bool attached, bool uniupdate)
    {
        if (string.IsNullOrEmpty(path))
        {
            Debug.LogWarning("path cant be null...");
            return(-1);
        }
        if (trans == null)
        {
            Debug.LogWarning("trans cant be null...");
            return(-1);
        }
        FxShell shell = _findAFreeShell();

        if (shell == null)
        {
            Debug.LogWarning("cant find a free fx...");
            return(-1);
        }

        var res = CacheCenter.Instance().GetRes(path);

        if (res == null)
        {
            Debug.LogWarning("cant find a fx named : " + path);
            return(-1);
        }

        if (attached)
        {
            if (!uniupdate)
            {
                res.transform.parent = trans;
            }
            else
            {
                res.transform.parent = null;
            }
        }
        else
        {
            res.transform.parent = trans;
        }

        res.transform.localPosition = localPos;
        res.transform.localRotation = Quaternion.identity;
        res.transform.localScale    = Vector3.one;

        s_ID++;
        shell.res    = res;
        shell.during = during;
        shell.active = true;
        shell.id     = s_ID;
        if (attached && uniupdate)
        {
            shell.attTrans = trans;
        }
        if (!attached)
        {
            res.transform.parent = null;
            if (!res.activeInHierarchy)
            {
                res.SetActive(true);
            }
        }

        if (during <= 0)
        {
            shell.loop = true;
        }

        return(s_ID++);
    }