Ejemplo n.º 1
0
    static bool InitializeSpawn(GameObject prefab, float addPool, int minPool, AP_enum.EmptyBehavior emptyBehavior, AP_enum.MaxEmptyBehavior maxEmptyBehavior, bool modBehavior)
    {
        if (prefab == null)
        {
            return(false);
        }                                                       // object wasn't defined

        if (opmScript == null)                                  // object pool manager script not located yet
        {
            opmScript = Object.FindObjectOfType <AP_Manager>(); // find it in the scene
            if (opmScript == null)
            {
                Debug.Log("No Object Pool Manager found in scene."); return(false);
            }                                                                                                             // didn't find an object pool manager
        }
        // found an object pool manager
        return(opmScript.InitializeSpawn(prefab, addPool, minPool, emptyBehavior, maxEmptyBehavior, modBehavior));
    }
Ejemplo n.º 2
0
    static bool InitializeSpawn(GameObject prefab, float addPool, int minPool, AP_enum.EmptyBehavior emptyBehavior, AP_enum.MaxEmptyBehavior maxEmptyBehavior, bool modBehavior)
    {
        if (prefab == null)
        {
            return(false);
        }                                                       // 未定义对象

        if (opmScript == null)                                  // 尚未找到对象池管理器脚本
        {
            opmScript = Object.FindObjectOfType <AP_Manager>(); // 在场景中找到它
            if (opmScript == null)
            {
                Debug.Log("No Object Pool Manager found in scene."); return(false);
            }                                                                                                             // 找不到对象池管理器
        }
        // 找到一个对象池管理器
        return(opmScript.InitializeSpawn(prefab, addPool, minPool, emptyBehavior, maxEmptyBehavior, modBehavior));
    }