Exemplo n.º 1
0
    // Start is called before the first frame update
    protected override void Start()
    {
        base.Start();

        projectiles = GetComponent <ObjectPoolHandler>();
        aimer       = GetComponent <IKGunAim>();
    }
Exemplo n.º 2
0
 private void Start()
 {
     platformPooler = ObjectPoolHandler.instance;
     platformTags   = new List <string>(platformPooler.poolDictionary.Keys);
     PlayerDistanceController.instance.onReachDistance += CreateMorePlatforms;
     ReloadHandler.instance.onClickPlay  += CreateMorePlatforms;
     ReloadHandler.instance.onClickRetry += ResetLastPlatform;
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     PopulateDictionary();
 }
Exemplo n.º 4
0
        private void Awake()
        {
            _shootProjectileModule = GetComponent <IShootProjectile>();

            if (!_projectile)
            {
                return;
            }

            _bulletPool = FindBulletPool();
        }
Exemplo n.º 5
0
        public ObjectPoolHandler FindBulletPool()
        {
            ObjectPoolHandler objectPoolHandler = FindObjectOfType <ObjectPoolHandler>();

            if (objectPoolHandler)
            {
                return(objectPoolHandler);
            }

            Debug.LogError("Could not find the Bullet Pool from the " + _projectile + " prefab.");

            return(null);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create a new ObjectPool
        /// </summary>
        /// <param name="handler">Handler for objects</param>
        /// <param name="config">Configuration for the pool</param>
        public ObjectPool(ObjectPoolHandler <T> handler,
                          ObjectPoolConfiguration config)
        {
            Assertions.NullCheck(handler, "handler");
            Assertions.NullCheck(config, "config");

            _handler = handler;
            //clone it
            _config =
                (ObjectPoolConfiguration)SerializerUtil.CloneObject(config);
            //validate it
            _config.Validate();
        }
Exemplo n.º 7
0
        private OP(int capacity)
        {
            if (capacity < 1)
            {
                capacity = 1;
            }

            this._returnHandler = this.ReturnObject;

            this._pool = new Queue <T>();

            for (int i = 0; i < capacity; i++)
            {
                T obj = CreateInstance();
                this._pool.Enqueue(obj);
            }

            this._capacity = capacity;
        }
Exemplo n.º 8
0
Arquivo: OP.cs Projeto: fengqk/Art
 internal void SetPoolHandler(ObjectPoolHandler handler) { this._handler = handler; }
Exemplo n.º 9
0
Arquivo: OP.cs Projeto: fengqk/Art
		protected OP_Base(int capacity)
		{
			if (capacity < 1)
				capacity = 1;

			this._returnHandler = this.ReturnObject;

			this._pool = new Queue<PoolableObject>();

			for (int i = 0; i < capacity; i++)
			{
				PoolableObject obj = CreateInstance();
				this._pool.Enqueue(obj);
			}

			this._capacity = capacity;
		}
Exemplo n.º 10
0
 internal void SetPoolHandler(ObjectPoolHandler handler)
 {
     this._handler = handler;
 }