Exemplo n.º 1
0
        public int CreateNewPlayerSlotCompoennt(PlayerStructure playerStructure)
        {
            ActivePlayerSlotComponent nextSlot = GameObject.Instantiate(_ActivePlayerSlotPrefab, this.transform).GetComponent <ActivePlayerSlotComponent>();

            nextSlot.SetPlayerStructure(playerStructure);
            _playerSlotComponentList.Add(nextSlot);
            return(nextSlot.GetInstanceID());
        }
Exemplo n.º 2
0
        public void DesactivePlayerSlot(int instanceId)
        {
            ActivePlayerSlotComponent currentSlot = _playerSlotComponentList.FirstOrDefault(e => e != null && e.GetInstanceID() == instanceId);

            if (currentSlot is null)
            {
                return;
            }
            _playerSlotComponentList.Remove(currentSlot);

            Destroy(currentSlot.gameObject);

            if (currentSlot.IsActive)
            {
                _playerStateManager.ActiveNewPlayerStructure(_playerSlotComponentList.Select(e => e.CurrentPLayerStructureInstanceId).FirstOrDefault());
            }
        }