예제 #1
0
    public Pickeditem(string _value, Vector3 _pos, int _itemPos, int _type)
    {
        m_obj = (GameObject)GameObject.Instantiate(GlobalItems.g_listOfObj[_type], _pos, Quaternion.identity);

        m_itemInfo = m_obj.GetComponent <ItemProperties>();
        GameObject.DestroyImmediate(m_obj.GetComponent <Rigidbody>());

        if (m_obj.GetComponent <BoxCollider>())
        {
            m_obj.GetComponent <BoxCollider>().isTrigger = true;
        }
        else if (m_obj.GetComponent <SphereCollider>())
        {
            m_obj.GetComponent <SphereCollider>().isTrigger = true;
        }
        else if (m_obj.GetComponent <CapsuleCollider>())
        {
            m_obj.GetComponent <CapsuleCollider>().isTrigger = true;
        }

        m_obj.layer = LayerMask.NameToLayer("Picked");
        m_obj.transform.localScale = Vector3.zero; // Start skala

        setMoveTo  = Positions.AddSub;
        setScaleTo = Scaling.PickupScale;

        p_pickedPos = pos;


        if (m_itemInfo.GetComponent <ItemProperties>().hasItem != null)
        {
            m_merge = m_itemInfo.GetComponent <ItemProperties>().hasItem;
        }

        if (m_itemInfo.TextValue == null)
        {
            m_itemInfo.TextValue = (GameObject)GameObject.Instantiate(GlobalItems.g_listOfObj[4], _pos, Quaternion.identity);
            m_itemInfo.TextValue.transform.parent = m_obj.transform;
            m_itemInfo.TextValue.GetComponent <TextMesh>().transform.localScale = new Vector3(2, 2, 2);
        }

        if (_value != ".")
        {
            m_itemInfo.setValue = float.Parse(_value);
        }
        else
        {
            m_itemInfo.texten = _value;
        }

        oldValue  = m_itemInfo.setValue;
        oldPosNeg = m_itemInfo.isNegative;
        StartMS(true, true);
        m_itemInfo.SpawnHitParticles();
    }