private void RemoveWorkerListViewElement(ListViewElementWorker element, ControlListView listView)
        {
            listView.RemoveControl(element.gameObject, false);
            element.gameObject.SetActive(false);

            if (null == WorkerListViewElementsPool)
            {
                WorkerListViewElementsPool = new ObjectPool <ListViewElementWorker>();
            }

            WorkerListViewElementsPool.AddObject(element);
        }
        /// <summary>
        /// Disables list view element and returns it back to pool
        /// </summary>
        /// <param name="element"></param>
        private void DisablePlayerListViewElement(ListViewElementPhotonPlayer element)
        {
            ListViewPlayers.RemoveControl(element.gameObject, false);

            if (null == ListViewElementPool)
            {
                ListViewElementPool = new ObjectPool <ListViewElementPhotonPlayer>();
            }

            element.gameObject.SetActive(false);
            ListViewElementPool.AddObject(element);
        }
Example #3
0
        private void RemoveCharacter(SharedWorker companyWorker)
        {
            SharedWorker removedChar = SpawnedCharacters.Find(x => x == companyWorker);

            if (null == CharactersPool)
            {
                CharactersPool = new ObjectPool <GameObject>();
            }

            removedChar.PhysicalCharacter.gameObject.SetActive(false);
            CharactersPool.AddObject(companyWorker.PhysicalCharacter);
            removedChar.PhysicalCharacter = null;
        }