Exemplo n.º 1
0
        public static AntPoolObject GetObject(string aName, Vector3 aPosition)
        {
            AntPoolObject result = GetObject(aName);

            if (result != null)
            {
                result.Position = aPosition;
            }
            return(result);
        }
Exemplo n.º 2
0
        public static T GetObject <T>(string aName, Vector2 aPosition)
        {
            T             result = default(T);
            AntPoolObject po     = GetObject(aName, aPosition);

            if (po != null)
            {
                result = po.GetComponent <T>();
            }
            return(result);
        }
Exemplo n.º 3
0
        public void AddObject(AntPoolObject aObject, bool aCheckCopy = false)
        {
            if (aCheckCopy)
            {
                int index = _objects.IndexOf(aObject);
                if (index >= 0 && index < _objects.Count)
                {
                    A.Warning("Object `{0}` already added to the pool!", aObject.name);
                    return;
                }
            }

            aObject.PlacedToPool();
            _currentIndex++;
            if (_currentIndex < _objects.Count)
            {
                _objects[_currentIndex] = aObject;
            }
            else
            {
                _objects.Add(aObject);
            }
        }