Example #1
0
 public T Get <T>(
     string strName,
     ePoolReturnType eReturnType   = ePoolReturnType.Disable,
     ePoolDestroyType eDestroyType = ePoolDestroyType.ChangeScene) where T : Component
 {
     return(SHGameObject.GetComponent <T>(Get(strName, eReturnType, eDestroyType)));
 }
Example #2
0
    public void DestroyObject()
    {
        m_eReturnType  = ePoolReturnType.None;
        m_eDestroyType = ePoolDestroyType.None;
        if (null == m_pObject)
        {
            return;
        }

        GameObject.DestroyObject(m_pObject);
    }
Example #3
0
 public SHObjectInfo(ePoolReturnType eReturnType, ePoolDestroyType eDestoryType, GameObject pObject)
 {
     m_eReturnType  = eReturnType;
     m_eDestroyType = eDestoryType;
     m_pObject      = pObject;
     if (null != m_pObject)
     {
         m_vStartPosition = m_pObject.transform.localPosition;
         m_qStartRotate   = m_pObject.transform.localRotation;
         m_vStartScale    = m_pObject.transform.localScale;
     }
 }
Example #4
0
    public GameObject Get(
        string strName,
        ePoolReturnType eReturnType   = ePoolReturnType.Disable,
        ePoolDestroyType eDestroyType = ePoolDestroyType.ChangeScene)
    {
        var pObject = GetInactiveObject(eReturnType, eDestroyType, strName);

        if (null == pObject)
        {
            return(null);
        }

        SetActiveObject(strName, pObject);
        return(pObject.m_pObject);
    }
Example #5
0
    private SHObjectInfo GetInactiveObject(ePoolReturnType eReturnType, ePoolDestroyType eDestroyType, string strName)
    {
        var pObjects = GetInactiveObjects(strName);

        if (0 == pObjects.Count)
        {
            return(new SHObjectInfo(
                       eReturnType, eDestroyType, Single.Resource.GetGameObject(strName)));
        }
        else
        {
            pObjects[0].m_eReturnType  = eReturnType;
            pObjects[0].m_eDestroyType = eDestroyType;
            return(pObjects[0]);
        }
    }