Esempio n. 1
0
    public GameObject GetBarrel(RangeType rangeType)
    {
        if (barrelPool.Count < 1)
        {
            FillBarrelPool();
        }
        Barrel     newBarrel = barrelPool.Dequeue();
        BarrelType type      = config.barrelTypes[0];

        for (int i = 0; i < config.barrelTypes.Length; i++)
        {
            if (config.barrelTypes[i].rangeType == rangeType)
            {
                type = config.barrelTypes[i];
                break;
            }
        }
        newBarrel.noStartingInit = true;
        newBarrel.Initialize(type);
        return(newBarrel.gameObject);
    }