Beispiel #1
0
    /* Run only Once */
    private void OnTriggerEnter2D(Collider2D other)
    {
        /* Other then player, dont check */
        if (other.GetComponent <Player2D_Manager>() == null)
        {
            return;
        }

        //* When Near for Interaction, player is not able to attack/move as it will focus on interaction */
        Debug.Log("Merchant: " + other);
        other.transform.GetChild(0).GetComponent <Player2D_Attack>().Interact = true;

#if UNITY_ANDROID || UNITY_IPHONE
        /* Change Attack Button to Interact Button */
        Interact_Btn.SetActive(true);
        Attack_Btn.SetActive(false);
#endif
    }
Beispiel #2
0
    void Start()
    {
        _player = GameObject.FindGameObjectWithTag("MeleeHitbox");

        /* Default state */
        m_state = "IDLE";
        idle.SetActive(true);
        interact.SetActive(false);
        bye.SetActive(false);

#if UNITY_ANDROID || UNITY_IPHONE
        /* Default Btn Layout */
        Attack_Btn = GameObject.FindGameObjectWithTag("Holder").GetComponent <MerchantHolder>().Attack_Btn;
        Attack_Btn.SetActive(true);

        Interact_Btn = GameObject.FindGameObjectWithTag("Holder").GetComponent <MerchantHolder>().Interact_Btn;
        Interact_Btn.SetActive(false);
#endif
    }
Beispiel #3
0
    /* When Player exits the area of Interaction */
    void OnTriggerExit2D(Collider2D other)
    {
        _isinRange = false;

        if (other.GetComponent <Player2D_Manager>() == null)
        {
            return;
        }

        if (other.transform.GetChild(0).GetComponent <Player2D_Attack>() != null)
        {
            other.transform.GetChild(0).GetComponent <Player2D_Attack>().Interact = false;
        }

#if UNITY_ANDROID || UNITY_IPHONE
        /* Change Attack Button to Interact Button */
        Attack_Btn.SetActive(true);
        Interact_Btn.SetActive(false);
#endif
    }