Пример #1
0
        void SaveWeapon()
        {
            if (targetModel == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(iteamName))
            {
                return;
            }

            ConsumableScriptableObject obj = Resources.Load("Retake.ConsumableScriptableObject") as ConsumableScriptableObject;

            if (obj == null)
            {
                return;
            }

            for (int i = 0; i < obj.consumabs.Count; i++)
            {
                if (obj.consumabs[i].itemName == iteamName)
                {
                    Consumable w = obj.consumabs[i];
                    w.r_model_eulers = targetModel.transform.localEulerAngles;
                    w.r_model_pos    = targetModel.transform.localPosition;

                    w.model_scale = targetModel.transform.localScale;

                    return;
                }
            }

            Debug.Log(iteamName + "was not found in the inventory");
        }
Пример #2
0
        public Consumable GetConsumable(string id)
        {
            ConsumableScriptableObject obj = Resources.Load("Retake.ConsumableScriptableObject") as ConsumableScriptableObject;

            if (obj == null)
            {
                Debug.Log("Retake.ConsumableScriptableObject could not be loaded!");
                return(null);
            }

            int index = GetConsumablesIdFromString(id);

            if (index == -1)
            {
                return(null);
            }

            return(obj.consumabs[index]);
        }
Пример #3
0
        void LoadConsumables()
        {
            ConsumableScriptableObject obj = Resources.Load("Retake.ConsumableScriptableObject") as ConsumableScriptableObject;

            if (obj == null)
            {
                Debug.Log("Retake.ConsumableScriptableObject could not be loaded!");
                return;
            }

            for (int i = 0; i < obj.consumabs.Count; i++)
            {
                if (consum_ids.ContainsKey(obj.consumabs[i].itemName))
                {
                    Debug.Log(obj.consumabs[i].itemName + "item is a dupilcate");
                }
                else
                {
                    consum_ids.Add(obj.consumabs[i].itemName, i);
                }
            }
        }