Пример #1
0
    public void SetSelectedShip(CombatShipController shipController)
    {
        if (shipController == _focusedShip)
        {
            return;
        }

        _focusedShip = shipController;
        OnFocusedShipChanged?.Invoke(shipController);
    }
Пример #2
0
    public void CreateWeaponCard(CombatShipController shipController, WeaponConfig weaponConfig)
    {
        GameObject     weaponCardObject = Instantiate(weaponConfig.WeaponCardPrefab.gameObject, _cardsParent);
        WeaponCardItem weaponCardItem   = weaponCardObject.GetComponent <WeaponCardItem>();

        weaponCardItem.Initialise(weaponConfig);

        if (_weaponCards.ContainsKey(shipController) == false)
        {
            _weaponCards.Add(shipController, new List <WeaponCardItem>());
        }

        _weaponCards[shipController].Add(weaponCardItem);
    }
Пример #3
0
    private void OnSelectionChanged(object sender, Entity oldEntity, Entity newEntity)
    {
        if (_focusedShip != null && newEntity == null)
        {
            _focusedShip = null;
            OnFocusedShipChanged?.Invoke(null);
            return;
        }

        if (_playerShips.Contains(newEntity as CombatShipController))
        {
            _focusedShip = newEntity as CombatShipController;
            OnFocusedShipChanged?.Invoke(_focusedShip);
            return;
        }
    }
Пример #4
0
    private void ActivateCardsForFocusedShip(CombatShipController shipController)
    {
        // Deactivate all cards
        HideAllCards();

        if (shipController == null || _weaponCards.ContainsKey(shipController) == false)
        {
            return;
        }

        // Activate juts the selected ship cards
        foreach (WeaponCardItem cardItem in _weaponCards[shipController])
        {
            cardItem.gameObject.SetActive(true);
        }
    }