コード例 #1
0
    protected void SpawnObject()
    {
        ISpawnebleObject obj = GetFromPool();

        if (obj != null)
        {
            obj.SetStartPosition(GetSpawnPosition());
        }
    }
コード例 #2
0
    protected ISpawnebleObject CreateObj()
    {
        GameObject       newObj       = Instantiate(objectPrefab);
        ISpawnebleObject spawnableObj = newObj.GetComponent <ISpawnebleObject>();

        if (spawnableObj != null)
        {
            objectPool.Add(spawnableObj);
            return(spawnableObj);
        }
        return(null);
    }