// Start is called before the first frame update protected override void Start() { base.Start(); projectiles = GetComponent <ObjectPoolHandler>(); aimer = GetComponent <IKGunAim>(); }
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(); }
private void Awake() { _shootProjectileModule = GetComponent <IShootProjectile>(); if (!_projectile) { return; } _bulletPool = FindBulletPool(); }
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); }
/// <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(); }
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; }
internal void SetPoolHandler(ObjectPoolHandler handler) { this._handler = handler; }
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; }