Exemplo n.º 1
0
    private void UpdateSecondarySlot()
    {
        switch (m_InventoryBehaviour.GetSecondarySlot())
        {
        case ItemType.Missile:
            m_MissileShoot.color    = m_OriginalColor;
            m_Invulnerability.color = m_HidedObjectColor;
            break;

        case ItemType.Invulnerability:
            m_MissileShoot.color    = m_HidedObjectColor;
            m_Invulnerability.color = m_OriginalColor;
            break;

        case ItemType.Empty:
            m_MissileShoot.color    = m_HidedObjectColor;
            m_Invulnerability.color = m_HidedObjectColor;
            break;
        }
    }
Exemplo n.º 2
0
    public void UseSecondaryInventorySlot()
    {
        if (!m_IsDead)
        {
            ItemType item = m_Inventory.GetSecondarySlot();
            switch (item)
            {
            case ItemType.Missile:
                Vector3 missilePosition = new Vector3(transform.position.x + m_BulletOffsetX, transform.position.y, transform.position.z);
                Fire(missilePosition, m_MissileBullet, m_MissileBulletRotation);
                m_AudioSource.PlayOneShot(m_MissileAudio);
                break;

            case ItemType.Invulnerability:
                ApplyInvulnerabilityPowerup();
                break;

            case ItemType.Empty:
                m_AudioSource.PlayOneShot(m_EmptyAudio);
                break;
            }
            m_Inventory.SetSecondarySlot(ItemType.Empty);
        }
    }