Exemplo n.º 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();
    }
Exemplo n.º 2
0
    public Pickeditem(ref GameObject _obj)
    {
        m_pickup   = true;
        _obj.layer = LayerMask.NameToLayer("Picked");
        m_obj      = _obj;

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

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

        GameObject.DestroyImmediate(_obj.GetComponent <Rigidbody>());

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

        m_itemInfo = _obj.GetComponent <ItemProperties>();
        if (hasMerged)
        {
            mergeType = m_merge[0].mergeType;
            oldValue  = m_itemInfo.itemOldValue;
        }
        else
        {
            oldValue = m_itemInfo.itemValue;
        }

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

        m_itemInfo.SpawnHitParticles();
    }
Exemplo n.º 3
0
    public Pickeditem(Pickeditem _obj)
    {
        m_obj      = (GameObject)GameObject.Instantiate(_obj.m_obj);
        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
        {
            mergeType = Powers.Convert;
            m_itemInfo.setPartValue(_obj.m_itemInfo.p1, _obj.m_itemInfo.p2);
            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;


        if (_obj.m_itemInfo.hasItem != null)
        {
            m_merge             = _obj.m_itemInfo.hasItem;
            m_itemInfo.setValue = _obj.m_itemInfo.setValue;
            mergeType           = Powers.Division;
        }

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