Esempio n. 1
0
    //! Is called almost all the frames for every collider other that is touching the trigger.
    /*! This message is sent to the trigger and the collider that touches the the trigger. */
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player" && allowGetData)
        {
            if (Input.GetKeyDown(keyToUse))
            {
                HudText.EraseText();
                allowGetData = false;

                //! Add the chart in inventory
                foreach (Texture2D item in pressSheets)
                {
                    Chart graph = Instantiate(chartPrefab) as Chart;
                    graph.transform.parent = inventory.transform;
                    graph.SetChart(item);
                    graph.gameObject.layer = 10;
                    inventory.AddChart(graph);
                }

                pressSheets.Clear();
            }
        }
    }