Пример #1
0
    public static PoolingController instance; //unique class instance for the easy access

    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
    }
Пример #2
0
 public void SetPoolingManager(PoolingController p_poolingController)
 {
     if (_poolingController != null)
     {
         Debug.LogWarning("AudioManagerBase: Overwriting pooling manager!");
     }
     _poolingController = p_poolingController;
 }
Пример #3
0
 public static PoolingController getInstance()
 {
     if (instance == null)
     {
         instance = FindObjectOfType <PoolingController>();
     }
     return(instance);
 }
Пример #4
0
        protected override void OnEnable()
        {
            base.OnEnable();
            ScenesManager.OnSceneIsGoingToLoad += OnSceneIsGoingToLoad;
            ScenesManager.OnSceneLoaded        += OnSceneLoaded;
            OnEnableChild();

            if (_poolingController == null)
            {
                _poolingController = GetComponentInChildren <PoolingController>();
            }
        }
Пример #5
0
    public void Initialize()
    {
        if (PoolingManager == null)
        {
            PoolingManager = this;
            // DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
        }

        foreach (Box obj in items)
        {
            obj.gameObject.SetActive(false);
        }
    }
Пример #6
0
    public void Initialize()
    {
        if (PoolingManager == null)
        {
            PoolingManager = this;
            // DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
        }

        foreach (Letter item in letters)
        {
            item.gameObject.SetActive(false);
        }
        foreach (Word item in wordbase)
        {
            item.gameObject.SetActive(false);
        }
    }
Пример #7
0
 void Awake()
 {
     s = this;
 }
Пример #8
0
 private void OnCollisionEnter(Collision other)
 {
     PoolingController.getInstance().AddToPool(gameObject);
 }
Пример #9
0
    void fire()
    {
        GameObject bullet = PoolingController.getInstance().GetBullet();

        bullet.GetComponent <BulletScript>().Fire(barrel);
    }