Ejemplo n.º 1
0
    private IEnumerator OpenTreasureAnimation()
    {
        m_PlayerMovment.m_currentState = PlayerMovment.PlayerState.receiving;
        m_Animator.SetBool("open", true);
        yield return(new WaitForSeconds(2f));

        if (m_DialogBox != null)
        {
            // Dialog windows on
            m_DialogBox.SetActive(true);
            // Dialog Text = contensts text
            m_DialogText.text = m_Contents.m_ItemDescription;

            // Add contents to inventory
            m_PlayerInventory.AddItem(m_Contents);
            m_PlayerInventory.m_currentItem = m_Contents;
            // Raise the signal to the player to animate set the treasure to open

            // Raise the signal to the player to stop animating
            // RAISE
            // Item:            Signal_ReceiveItem
            // Local:           ScriptableObjects/Player
            // Capturado por:   Player->Receive Item
            // Método:          Scripts/Player Scripts/PlayerMovment.cs->RaiseItem()
            m_RaiseItem.Raise();
        }
        else
        {
            m_TreasureState = TreasureState.Open;
            m_PlayerMovment.m_currentState = PlayerMovment.PlayerState.interact;
        }

        // RAISE
        // Signal:          Signal_ContextClueOff
        // Local Signal:    ScriptableObjects/Context Clue
        // Capturado por:   Player
        // Método:          Scripts/Player Scrips/ContextClue.cs->Disable()
        m_ContextOff.Raise();
        m_UseContext = false;
    }
Ejemplo n.º 2
0
 public virtual void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.CompareTag("PlayerBody"))
     {
         if (m_ContextOff != null && m_UseContext)
         {
             // RAISE
             // Signal:          Signal_ContextClueOff
             // Local Signal:    ScriptableObjects/Context Clue
             // Capturado por:   Player
             // Método:          Scripts/Player Scrips/ContextClue.cs->Disable()
             m_ContextOff.Raise();
         }
         m_PlayerMovment.Interacting(false);
         m_PlayerInRange = false;
     }
 }
Ejemplo n.º 3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("PlayerBody"))
     {
         if (m_ContextOn != null && m_UseContext)
         {
             // RAISE
             // Signal:          Signal_ContextClueOn
             // Local Signal:    ScriptableObjects/Context Clue
             // Capturado por:   Player
             // Método:          Scripts/Player Scrips/ContextClue.cs->Enable()
             m_ContextOn.Raise();
         }
         m_PlayerMovment.Interacting(true);
         m_PlayerInRange = true;
     }
 }
Ejemplo n.º 4
0
    public void Knock(float knockTime, float damage)
    {
        // Evita entrar em estado de stagger 2 vezes
        if (m_currentState != PlayerState.stagger)
        {
            // RAISE
            // Signal:          Signal_ScreenKick
            // Local Signal:    ScriptableObjects/Camera
            // Capturado por:   Main Camera
            // Método:          Scripts/Camera/CameraMovment.cs->BeginKick()
            m_ScreenKick.Raise();
            m_currentState = PlayerState.stagger;
            // Evita Null exception se o objeto não for associado
            if (m_currentHealth != null)
            {
                m_currentHealth.m_RuntimeValue -= damage;
                if (m_PlayerHealthSignalList != null)
                {
                    // RAISE
                    // Signal:          Signal_Health
                    // Local Signal:    ScriptableObjects/Player/Health
                    // Capturado por:   Player
                    // Método:          Script/Player Script/HearthManager.cs->UpdateHearts()
                    m_PlayerHealthSignalList.Raise();
                }

                if (m_currentHealth.m_RuntimeValue > 0)
                {
                    StartCoroutine(Knock_Coroutine(knockTime));
                }
                else
                {
                    // Some com o Player
                    this.gameObject.SetActive(false);
                    m_currentState = PlayerState.die;
                }
            }
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Recebe um item. Espada ou chave
 /// </summary>
 public void ReceiveItem()
 {
     if (m_currentState == PlayerState.receiving)
     {
         m_Animator.SetBool("receive item", true);
         if (m_ReceivedItemSprite != null)
         {
             m_ReceivedItemSprite.sprite = m_PlayerInventory.m_currentItem.m_ItemSprite;
             if (m_PlayerInventory.m_currentItem == m_Sword)
             {
                 m_CanvasSword.Raise();
             }
         }
     }
     else
     {
         m_Animator.SetBool("receive item", false);
         if (m_ReceivedItemSprite != null)
         {
             m_ReceivedItemSprite.sprite = null;
         }
         m_currentState = PlayerState.interact;
     }
 }