Ejemplo n.º 1
0
        private void SetEquipmentObject(List <GameObject> objectsList, EquipmentModel[] equipmentModels, int level, out BaseEquipmentEntity equipmentEntity)
        {
            equipmentEntity = null;
            if (objectsList == null || equipmentModels == null || equipmentModels.Length == 0)
            {
                return;
            }

            GameObject          boneObj;
            GameObject          tempEquipmentObject;
            BaseEquipmentEntity tempEquipmentEntity;

            foreach (EquipmentModel equipmentModel in equipmentModels)
            {
                if (string.IsNullOrEmpty(equipmentModel.equipSocket) ||
                    equipmentModel.model == null)
                {
                    // If data is empty, skip it
                    continue;
                }

                boneObj = CacheUmaData.GetBoneGameObject(equipmentModel.equipSocket);
                if (boneObj == null)
                {
                    continue;
                }

                tempEquipmentObject = Instantiate(equipmentModel.model);
                tempEquipmentObject.transform.SetParent(boneObj.transform, false);
                tempEquipmentObject.transform.localPosition    = equipmentModel.localPosition;
                tempEquipmentObject.transform.localEulerAngles = equipmentModel.localEulerAngles;
                tempEquipmentObject.transform.localScale       = equipmentModel.localScale;
                tempEquipmentObject.gameObject.SetActive(true);
                tempEquipmentObject.gameObject.SetLayerRecursively(EquipmentLayer, true);
                tempEquipmentObject.RemoveComponentsInChildren <Collider>(false);
                tempEquipmentEntity = tempEquipmentObject.GetComponent <BaseEquipmentEntity>();
                if (tempEquipmentEntity != null)
                {
                    tempEquipmentEntity.Level = level;
                    if (equipmentEntity == null)
                    {
                        equipmentEntity = tempEquipmentEntity;
                    }
                }

                objectsList.Add(tempEquipmentObject);
            }
        }
Ejemplo n.º 2
0
        private void SetEquipmentObject(List <GameObject> objectsList, EquipmentModel[] equipmentModels, int level, List <Transform> missileDamageTransforms = null)
        {
            if (objectsList == null || equipmentModels == null || equipmentModels.Length == 0)
            {
                return;
            }

            GameObject boneObj;

            foreach (EquipmentModel equipmentModel in equipmentModels)
            {
                if (string.IsNullOrEmpty(equipmentModel.equipSocket) ||
                    equipmentModel.model == null)
                {
                    // If data is empty, skip it
                    continue;
                }

                boneObj = CacheUmaData.GetBoneGameObject(equipmentModel.equipSocket);
                if (boneObj == null)
                {
                    continue;
                }

                tempEquipmentObject = Instantiate(equipmentModel.model);
                tempEquipmentObject.transform.SetParent(boneObj.transform, false);
                tempEquipmentObject.transform.localPosition    = Vector3.zero;
                tempEquipmentObject.transform.localEulerAngles = Vector3.zero;
                tempEquipmentObject.transform.localScale       = Vector3.one;
                tempEquipmentObject.gameObject.SetActive(true);
                tempEquipmentObject.gameObject.SetLayerRecursively(gameInstance.characterLayer.LayerIndex, true);
                tempEquipmentObject.RemoveComponentsInChildren <Collider>(false);
                tempEquipmentEntity = tempEquipmentObject.GetComponent <BaseEquipmentEntity>();
                if (tempEquipmentEntity != null)
                {
                    tempEquipmentEntity.Level = level;
                    if (missileDamageTransforms != null && tempEquipmentEntity.missileDamageTransform != null)
                    {
                        missileDamageTransforms.Add(tempEquipmentEntity.missileDamageTransform);
                    }
                }

                objectsList.Add(tempEquipmentObject);
            }
        }