示例#1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Wall"))
     {
         poolManager.Add("bullet", gameObject);
     }
 }
示例#2
0
 //initialize this pool
 void Awake()
 {
     //add this pool to the PoolManager dictionary
     PoolManager.Add(this);
     //set container object to this transform
     container = transform;
     //load specified amount of objects before playtime
     PreLoad();
 }
示例#3
0
    /// <summary>
    /// Initialization called by PoolManager on runtime created pools.
    /// </summary>
    public void Awake()
    {
        //can't initialize without prefab
        if (prefab == null)
        {
            return;
        }

        //add this pool to the PoolManager dictionary
        PoolManager.Add(this);

        //for networked synced pools: get the network identity,
        //register with the Unity Networking spawning system
        PreLoad();
    }
示例#4
0
    private void Start()
    {
        // add this pool to the list of pool manager
        PoolManager.Add(this);
        objToPool = ProductToPool.gameObject;


        for (int i = 0; i < amountTopool; i++)
        {
            GameObject poolObj = Instantiate(objToPool, transform);

            poolObj.SetActive(false);
            poolObj.GetComponent <DisableObjectAfterTime>().pool = this;
            pool.Add(poolObj);
        }
    }
示例#5
0
 protected void Awake()
 {
     members = new List <T>();
     foreach (Transform child in transform)
     {
         T item = child.GetComponent <T>();
         if (item != null)
         {
             Add(item);
         }
     }
     if (copyOnStart > 0)
     {
         copiesPending = copyOnStart;
         AddClones(copyRate);
     }
     PoolManager.Add(this);
     OnAwake();
 }
示例#6
0
文件: Pools.cs 项目: zhao223/FPS
 private void Awake()
 {
     ThisGameObjectPosition = transform;
     PreLoadGameObject();
     PoolManager.Add(this);
 }
示例#7
0
 public void AddToPool(GameObject obj)
 {
     poolManager.Add("bullet", obj);
 }
 // Use this for initialization
 void Start()
 {
     timer = deltaTime;
     PoolManager.Add(decalName, Mathf.CeilToInt((float)1 / deltaTime) + 1);
     Debug.Log("z");
 }