示例#1
0
    public void SetDamageOutput(int damege, Vector3 Pos, bool critical)
    {
        bool _make = false;

        Pos = new Vector3(Pos.x, Pos.y + 220, Pos.z);

        for (int i = 0; i < m_LisDamageTxt.Count; ++i)
        {
            if (!m_LisDamageTxt[i].activeSelf)
            {
                m_LisDamageTxt[i].SetActive(true);
                m_LisDamageTxt[i].transform.position = Pos;

                if (critical)
                {
                    m_DicDamageTxt[m_LisDamageTxt[i]].SetTxt("CRITICAL");
                }
                else
                {
                    m_DicDamageTxt[m_LisDamageTxt[i]].SetTxt(damege.ToString());
                }
                _make = true;

                StartCoroutine(TimeActiveFalse(m_LisDamageTxt[i], 0.7f, null));
                break;
            }
        }

        if (!_make)
        {
            GameObject damageObj = Instantiate(DamageObj, Pos, Quaternion.identity);
            DamageTxt  damageTxt = damageObj.GetComponent <DamageTxt>();

            damageObj.transform.SetParent(DamageBox);
            m_LisDamageTxt.Add(damageObj);

            m_DicDamageTxt.Add(m_LisDamageTxt[m_LisDamageTxt.Count - 1], damageTxt);

            damageTxt.Init();
            damageTxt.SetTxt(damege.ToString());

            StartCoroutine(TimeActiveFalse(damageObj, 0.7f, null));
        }
    }
示例#2
0
    public void Init(out GetQuset getQuset, MakeBoss makeBoss, PlayerAbility playerAbility)
    {
        DamageObj = Resources.Load("UI/Box/DamegeTxt") as GameObject;
        NameObj   = Resources.Load("UI/Box/NameTxt") as GameObject;
        HpObj     = Resources.Load("UI/Box/HpImg") as GameObject;

        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Buy_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Quest_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Portion_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Boss_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Clear_NPC") as GameObject);

        //데미지 부분 미리 10개 생성
        for (int i = 0; i < 10; ++i)
        {
            GameObject damageObj = Instantiate(DamageObj);

            DamageTxt damageTxt = damageObj.GetComponent <DamageTxt>();
            damageObj.transform.SetParent(DamageBox);

            m_LisDamageTxt.Add(damageObj);
            m_DicDamageTxt.Add(m_LisDamageTxt[i], damageTxt);

            damageTxt.Init();
            damageObj.SetActive(false);
        }

        for (int i = 0; i < 5; ++i)
        {
            GameObject hpObj = Instantiate(HpObj, HpBox.transform);
            Image      hpimg = hpObj.GetComponent <Image>();
            m_LisHpImg.Add(hpObj);
            m_DicHpImg.Add(i, hpimg);
            hpObj.SetActive(false);

            GameObject nameObj = Instantiate(NameObj, NameBox.transform);
            Text       nameTxt = nameObj.GetComponent <Text>();
            m_LisNameTxt.Add(nameObj);
            m_DicNameTxt.Add(i, nameTxt);
            nameObj.SetActive(false);

            ++m_nAddCount;
        }

        m_DicIndexObj.Add(m_BuyMenu.gameObject, 0);
        m_DicIndexObj.Add(m_QuestMenu.gameObject, 1);
        m_DicIndexObj.Add(m_PortionMenu.gameObject, 2);
        m_DicIndexObj.Add(m_BossClearAsk.gameObject, 3);

        m_DicIndex.Add(0, m_BuyMenu.gameObject);
        m_DicIndex.Add(1, m_QuestMenu.gameObject);
        m_DicIndex.Add(2, m_PortionMenu.gameObject);
        m_DicIndex.Add(3, m_GateAsk.gameObject);
        m_DicIndex.Add(4, m_BossClearAsk.gameObject);

        Object[] weaponbtnObj = null;
        Object[] defenseObj   = Resources.LoadAll("UI/EquipmentBtn/Armor");
        Object[] portionObj   = Resources.LoadAll("UI/EquipmentBtn/Portion");

        switch (playerAbility.m_nIndex)
        {
        case 1:
            weaponbtnObj = Resources.LoadAll("UI/EquipmentBtn/Weapon/TowHandSword");
            break;

        case 2:
            weaponbtnObj = Resources.LoadAll("UI/EquipmentBtn/Weapon/Magician");
            break;
        }

        for (int i = 0; i < weaponbtnObj.Length; ++i)
        {
            m_LisWeaponBtnObj.Add(weaponbtnObj[i] as GameObject);
        }
        for (int i = 0; i < defenseObj.Length; ++i)
        {
            m_LisDefenseBtnObj.Add(defenseObj[i] as GameObject);
        }
        for (int i = 0; i < portionObj.Length; ++i)
        {
            m_LisPortionBtnObj.Add(portionObj[i] as GameObject);
        }
        m_BuyMenu.Init(m_LisWeaponBtnObj, m_LisDefenseBtnObj, playerAbility);
        m_QuestMenu.Init(out getQuset);
        m_PortionMenu.Init(m_LisPortionBtnObj);

        PlayerPos _playerPos = m_BossClearAsk.Init();

        m_GateAsk.Init(makeBoss, _playerPos, QuestBox.gameObject);
    }