示例#1
0
 // Use this for initialization
 void Awake()
 {
     m_TempColor = Color.white;
     m_TestItem = null;
     m_Renderer = GetComponent<MeshRenderer>();
     gameObject.SetActive(false);
 }
示例#2
0
        public void SetItemData(Item item)
        {
            m_Icon.texture = item.ItemTex;
            m_Name.text = item.Name;
            m_Info.text = item.Info;
            m_Price.text = item.Price.ToString();

            m_SelfItem = item;
        }
示例#3
0
        /// <summary>
        /// 设置该3D物品的参数
        /// </summary>
        public void SetItem3D(Item item, Vector3 pos)
        {
            transform.position = pos;

            m_TempColor.a = 1.0f;
            m_TestItem = item;
            m_Renderer.material.mainTexture = item.ItemTex;
            m_Renderer.material.SetColor("_Color", m_TempColor);
            m_IsPicked = false;
            gameObject.SetActive(true);
        }
示例#4
0
        // Update is called once per frame
        public void OnTriggerEnter(Collider colli)
        {
            if(colli.tag == "Player" && m_TestItem != null)
            {
                DungonManager.Inst.Player.PackageManager.AddItem(m_TestItem);
                gameObject.SetActive(false);
                m_IsPicked = true;

                // 既然当前的ITEM已经传入了背包中,则当前的Item必须重新产生,
                // 否则下一次对该Item的修改,将会影响背包中对应的Item
                m_TestItem = null;
                m_TestItem = new ItemTest();
            }
        }
示例#5
0
        public void SetAItem(Item item, Vector3 pos)
        {
            if(m_CurUseCount >= m_Item3DList.Count)
            {
                Debug.Log("物品掉落不够用了");
                return;
            }

            if(item == null)
            {
                return;
            }

            m_Item3DList[m_CurUseCount].SetItem3D(item, pos);
            ++m_CurUseCount;
        }
示例#6
0
        /// <summary>
        /// 处理购买物品的情况
        /// </summary>
        public void OnBuy(Item item)
        {
            if(item.Price > m_Data.gold)
            {
                return;
            }

            m_Data.gold -= item.Price;
            if(m_PackageManager.AddItem(item))
            {
                HintTextManager.Inst.ShowHintText("购买了" + item.Name, 2f );
            }
        }
示例#7
0
 public void SetItem(Item item, int index)
 {
     m_SelfIcon.texture = item.ItemTex;
     m_ItemIndexInPackge = index;
 }
示例#8
0
 public void AddItem(Item item)
 {
     m_ItemDict.Add(item.Id, item);
 }