Ejemplo n.º 1
0
    public override void Init(CUnit unit)
    {
        CPlayerUnit player = unit as CPlayerUnit;

        if (player == null)
        {
            return;
        }

        base.Init(unit);

        if (m_vowIcon != null && m_vowIcons.Length >= 2)
        {
            m_vowIcon.sprite = m_vowIcons[(int)player.Gender];
        }

        m_input     = player.InputCtrl;
        m_inventory = player.Inventory;

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;

        if (m_menuGo != null)
        {
            m_menuGo.SetActive(false);
        }

        InventoryCheck();
    }
Ejemplo n.º 2
0
    public void RestPlayer(CPlayerUnit player)
    {
        //TODO: 플레이어의 체력을 회복 시키고 일정시간동안 못 움직이게 한다.
        if (player.Status.CurState == State.Rest)
        {
            return;
        }

        player.ResetUnit();
    }
Ejemplo n.º 3
0
    void OnTriggerStay(Collider other)
    {
        CPlayerUnit player = other.GetComponent <CPlayerUnit>();

        if (player != null)
        {
            if (Input.GetButtonUp("Submit"))
            {
                if (m_item != null)
                {
                    if (m_item is IEquipment)
                    {
                        IEquipment equipment = m_item as IEquipment;

                        Data.EquipmentBoxInfo equipmentInfo = new Data.EquipmentBoxInfo();
                        equipmentInfo.partsType = equipment.PartsType;
                        equipmentInfo.index     = m_item.ItemIdx;

                        CDataManager.Inst.PlayerRecord.BoxInfo.equipmentList.Add(equipmentInfo);
                    }
                    else
                    {
                        ItemData item = new ItemData();
                        item.item  = m_item;
                        item.count = 1;

                        player.Inventory.ItemAdd(item);
                    }
                }

                if (m_itemInfoGO != null)
                {
                    m_itemInfoGO.SetActive(false);
                }

                if (CSoundManager.Inst != null && m_effectSource != null)
                {
                    CSoundManager.Inst.EffectPlay(m_effectSource);
                }

                if (m_collider != null)
                {
                    m_collider.enabled = false;
                }

                Invoke("PooledThis", 0.5f);

                return;
            }
        }
    }
Ejemplo n.º 4
0
    protected override void DetectedItemAction()
    {
        if (!CanMove || IsUseItem || !m_movement.IsOnGround || InAction)
        {
            return;
        }

        if (!m_input.InputData.btnInputs[(int)InputIndex.B])
        {
            return;
        }

        CPlayerUnit player = m_unit as CPlayerUnit;

        if (player == null)
        {
            return;
        }
        CInventory inventory = player.Inventory;

        if (inventory == null)
        {
            return;
        }

        IsUseItem = true;
        m_anim.SetBool("IsUseItem", IsUseItem);

        CUseItem item = inventory.ItemUse(inventory.CurItemSelect) as CUseItem;
        int      nIdx = (int)UseAnimType.MAX;

        if (item == null)
        {
            m_anim.Play("Item" + nIdx);
            return;
        }

        nIdx = (int)item.UseAnimType;

        // 아이템 사용 번호에 따라 아이템 액션 변경 및 던지는 물체의 경우 발사체 소환
        m_anim.Play("Item" + nIdx);

        m_unit.CurUseItem = item;
    }
Ejemplo n.º 5
0
    public void AddDeathCount(CPlayerUnit player)
    {
        if (player == null)
        {
            return;
        }

        if (player.tag != "Player")
        {
            return;
        }

        m_deathCount++;

        if (m_deathCount >= m_deathLimit)
        {
            QuestFailed();
        }
    }
Ejemplo n.º 6
0
    IEnumerator InitCoroutine()
    {
        while (!GameManager.Inst.IsGameStart)
        {
            yield return(null);
        }

        GameObject playerGo = null;

        while (playerGo == null)
        {
            playerGo = GameObject.FindWithTag("Player");
            yield return(null);
        }

        CPlayerUnit player = playerGo.GetComponent <CPlayerUnit>();

        m_target = player;

        m_camera.enabled = true;
    }
Ejemplo n.º 7
0
    IEnumerator InventoryUICoroutine()
    {
        while (m_player == null)
        {
            yield return(null);

            GameObject playerGo = GameObject.FindWithTag("Player");
            if (playerGo == null)
            {
                continue;
            }

            m_player = playerGo.GetComponent <CPlayerUnit>();
        }

        while (m_player.Inventory == null)
        {
            yield return(null);
        }

        m_InventoryUI.Init(m_player.Inventory);
    }