Example #1
0
    void OnTriggerStay2D(Collider2D other)
    {
        if (!autoStarting && !tagStarted && Input.GetKeyDown(KeyCode.Return))
        {
            if (dr == null)
            {
                initDR();
            }
            string tagName = other.tag;
            Debug.Log(tagName);
            switch (tagName)
            {
            case "DiningTable":
                Debug.Log("dining");
                if (other.gameObject != null)
                {
                    Cereal c = other.gameObject.GetComponent <Cereal>();
                    if (c != null)
                    {
                        dr.SetInfoTarget("cereal", c);
                        cerealing = true;
                    }
                }
                break;

            default:
                dr.DisableInfo();
                cerealing = false;
                break;
            }

            if (dr.Begin(tagName))
            {
                //_playerController.busy = true;
                _playerController.playerMoving = false;
                _playerController.busy         = true;
                tagStarted = true;
                Debug.Log("beginning " + tagName);
            }
            else
            {
                //_playerController.busy = false;
                _playerController.playerMoving = true;
                _playerController.busy         = false;
                tagStarted = false;
                Debug.Log("can't begin " + tagName);
            }
        }
    }