Example #1
0
    void onAccept()
    {
        if (m_ship.modifiers.Count == 1)
        {
            m_ship.modifiers[0] = m_modifier;
        }
        else
        {
            m_ship.modifiers[m_crusherPosition] = m_modifier;
            m_ship.modifiers.RemoveAt(m_crusherPosition + 1);
            GameInfos.playerModifierCount--;
        }

        m_ship.updateModifierStats();
        Event <UpdateUIEvent> .Broadcast(new UpdateUIEvent(m_ship));

        var size = m_background.size;

        onCrush(new CrushEvent(new Modifier(), m_ship));
        m_background.size = size;
        m_active          = false;

        SoundSystem.instance.play(m_crushClip);

        Event <PlayCameraEffectEvent> .Broadcast(new PlayCameraEffectEvent(CameraEffectType.Shake, 1, 0.5f));

        m_particles.Play();
        DOVirtual.DelayedCall(m_particlePlayTime, () => m_particles.Stop());

        DOVirtual.DelayedCall(m_crushTime, () => onCancel(false));
    }
Example #2
0
 private void Start()
 {
     if (GameInfos.modifiers != null)
     {
         m_ship.modifiers = GameInfos.modifiers;
         m_ship.updateModifierStats();
         m_ship.life = GameInfos.life;
         if (m_ship.life > m_ship.maxLife)
         {
             m_ship.life = m_ship.maxLife;
         }
     }
     Event <UpdateUIEvent> .Broadcast(new UpdateUIEvent(m_ship));
 }
Example #3
0
    void Update()
    {
        if (GameInfos.paused || m_ship == null)
        {
            return;
        }

        if ((m_player.transform.position - m_exitPosition.position).sqrMagnitude < m_lootRadius * m_lootRadius)
        {
            m_button.SetActive(true);
            m_button.transform.position = m_exitPosition.position + m_buttonOffset;
            if (Input.GetButtonDown(lootButton))
            {
                useTeleporter();
            }
            return;
        }

        var loot = LootManagerLogic.instance.getNearestLootInRadius(m_player.transform.position, m_lootRadius);

        if (loot == null)
        {
            m_button.SetActive(false);
            return;
        }

        m_button.SetActive(true);
        m_button.transform.position = loot.transform.position + m_buttonOffset;

        if (Input.GetButtonDown(lootButton))
        {
            SoundSystem.instance.play(m_takeObjectClip);
            if (m_ship.modifiers.Count < GameInfos.playerModifierCount)
            {
                m_ship.modifiers.Add(loot.modifier);
                m_ship.updateModifierStats();
                Event <UpdateUIEvent> .Broadcast(new UpdateUIEvent(m_ship));
            }
            else
            {
                Event <CrushEvent> .Broadcast(new CrushEvent(loot.modifier, m_ship));
            }

            Destroy(loot.gameObject);
        }
    }