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(); }
public void MergeNewDivi(Pickeditem _obj) { decimal temp = (decimal)m_itemInfo.getNormalValue; Delete(); m_obj = (GameObject)GameObject.Instantiate(GlobalItems.g_listOfObj[2]); m_obj.layer = LayerMask.NameToLayer("Picked"); GameObject.Destroy(m_obj.GetComponent <Rigidbody>()); m_obj.transform.localScale = new Vector3(0.05f, 0.05f, 0.1f); if (m_itemInfo == null) { m_itemInfo = m_obj.GetComponent <ItemProperties>(); } m_itemInfo.setPartValue((float)temp, _obj.m_itemInfo.getNormalValue); mergeType = Powers.Convert; GameObject.DestroyImmediate(_obj.m_obj.GetComponent <ItemProperties>().TextValue); GameObject.DestroyImmediate(_obj.m_obj); }