Example #1
0
        private void M_inputAction_performed(InputAction.CallbackContext obj)
        {
            FieldUnitSearcher fus = m_unitCore.GetComponent <FieldUnitSearcher>();
            TalkBase          tb  = fus.m_talkTarget;
            ChestBase         cb  = fus.m_chestTarget;
            SequencePlayer    sp  = fus.m_sequencePlayer;

            //Debug.Log(tb);
            if (sp != null)
            {
                UnitFreeze(true);
                StartCoroutine(sp.PlaySequences(() =>
                {
                    UnitFreeze(false);
                }));
            }
            else if (tb != null)
            {
                m_btnAction.gameObject.SetActive(false);
                m_btnMenu.gameObject.SetActive(false);
                m_unitCore.GetComponent <FieldUnitMover>().enabled = false;
                StartCoroutine(TalkManager.Instance.Talk(tb.message, () =>
                {
                    m_unitCore.GetComponent <FieldUnitMover>().enabled = true;
                    m_btnAction.gameObject.SetActive(true);
                    m_btnMenu.gameObject.SetActive(true);
                }));
            }
            else if (cb != null)
            {
                ChestManager.Instance.OpenChest(cb);
            }
        }
Example #2
0
        private void Update()
        {
            m_talkTarget = null;
            RaycastHit2D raycastHit2D = Physics2D.Raycast(
                gameObject.transform.position,
                GetComponent <FieldUnitCore>().m_fieldUnitProperty.direction,
                1.0f,
                LayerMask.GetMask(new string[] { "people", "chest" }));

            if (raycastHit2D.collider != null)
            {
                m_sequencePlayer = raycastHit2D.collider.gameObject.GetComponent <SequencePlayer>();
                m_talkTarget     = raycastHit2D.collider.gameObject.GetComponent <TalkBase>();
                m_chestTarget    = raycastHit2D.collider.gameObject.GetComponent <ChestBase>();
            }
        }