Ejemplo n.º 1
0
 void OnObjectPicked(ObjectPickedEvent e)
 {
     DOVirtual.DelayedCall(0.01f, () =>
     {
         if (this == null)
         {
             return;
         }
         UpdatePrice();
     });
 }
Ejemplo n.º 2
0
    void OnObjectPicked(ObjectPickedEvent e)
    {
        if (e.sprite != null)
        {
            var        obj   = Instantiate(m_itemShowPrefab, transform);
            Vector2Int index = new Vector2Int(m_itemCount % m_itemNbWidth, m_itemCount / m_itemNbWidth);
            obj.transform.localPosition = new Vector2(index.x * m_itemtWidth, index.y * m_itemHeight);
            var renderer = obj.GetComponentInChildren <Image>();
            if (renderer != null)
            {
                renderer.sprite = e.sprite;
                renderer.SetNativeSize();
                renderer.color = m_imageColor;
            }
            obj.transform.localScale = new Vector3(m_itemScale, m_itemScale, m_itemScale);

            m_itemCount++;
        }

        if (e.modifier != null)
        {
            PlayerStats.Instance().AddStatModifier(e.modifierName, e.modifier);
        }
    }