Example #1
0
    // Collision for interact key
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Plot")
        {
            plotController = other.gameObject.GetComponent <PlotController>();
            plotInRange    = true;
            plotController.Select();
        }

        if (other.gameObject.tag == "Merchant")
        {
            market        = other.gameObject.GetComponent <Merchant>();
            marketInRange = true;
            market.Select();
        }

        if (other.gameObject.tag == "Mixer")
        {
            mixer        = other.gameObject.GetComponent <Mixer>();
            mixerInRange = true;
            mixer.Select();
        }
        if (other.gameObject.tag == "Table" && (other.gameObject.transform.childCount == 1 ||
                                                (other.gameObject.transform.childCount > 1 && (!ContainsChildWithTag(other.gameObject, "Merchant") || !ContainsChildWithTag(other.gameObject, "Mixer")))))
        {
            table        = other.gameObject.GetComponent <Table>();
            tableInRange = true;
            table.Select();
        }
        if (other.gameObject.tag == "Item" && other.gameObject.transform.parent == null)
        {
            itemInWorld = other.gameObject.GetComponent <Item>();
            itemInRange = true;
            itemInWorld.Select();
        }
    }