Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        public void OpenChest(ChestBase _chest)
        {
            int chest_instance_id = _chest.GetInstanceID();

            if (!m_strOpenedChestId.Contains(chest_instance_id))
            {
                m_strOpenedChestId.Add(chest_instance_id);
                _chest.Open();
            }
        }
Ejemplo n.º 3
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>();
            }
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            ChestBase script = target as ChestBase;

            base.OnInspectorGUI();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Open"))
            {
                script.Open();
            }
            if (GUILayout.Button("Close"))
            {
                script.Close();
            }

            GUILayout.EndHorizontal();
        }