private void Unclone(Item item) { if (item.IsClone) { var clone = new CloneItem(item); var fullItem = clone.Unclone(); if (PassThru) { WriteItem(fullItem); } } else { if (!item.IsItemClone) { WriteError(typeof(InvalidTypeException), $"Item `{item.GetProviderPath()}` is not a clone.", ErrorIds.InvalidItemType, ErrorCategory.InvalidType, item); } } if (Recurse) { foreach (Item child in item.Children) { Unclone(child); } } }
protected override void ProcessItem(Item item) { if (!item.IsItemClone) { WriteError(typeof(ArgumentException), "The specified item is not a clone.", ErrorIds.InvalidItemType, ErrorCategory.InvalidArgument, null); return; } if (ShouldProcess(item.GetProviderPath(), "Convert item clone to full item")) { var clone = new CloneItem(item); WriteItem(clone.Unclone()); } }
protected void UncloneItemRecursive(Item item) { if (item.IsClone) { var clone = new CloneItem(item); clone.Unclone(); } foreach (Item child in item.Children) { UncloneItemRecursive(child); } }
public void _GotoInit() { Debug.Log("Game Core goto InitGame: " + DataManager.CurrentItem.score); GameStatisticsManager.Score = 0; if (PlayerPrefs.GetInt(Constant.IS_RANDOM_ITEM_PREFS, 0) == 1) { DataManager.CurrentItem.isSelected = false; DataManager.CurrentItem = DataManager.ItemsAsset.list[UnityEngine.Random.Range(1, DataManager.ItemsAsset.list.Count)]; DataManager.CurrentItem.isSelected = true; } var b = Instantiate(DataManager.CurrentItem.prefab, new Vector3(0.08f, 3.23f, 0), Quaternion.identity); b.transform.SetParent(itemInGameContro.transform); this.clone = b.GetComponent <CloneItem>(); _LoadLogicEnemy(); _Reset(); toucPause.SetActive(false); /// vao game }
protected override void ProcessItem(Item item) { if (!item.IsItemClone) { WriteError ( new ErrorRecord ( new PSArgumentException("The supplied Item is not a clone!"), "supplied_item_is_not_a_clone", ErrorCategory.InvalidArgument, null ) ); return; } if (ShouldProcess(item.GetProviderPath(), "Convert item clone to full item")) { var clone = new CloneItem(item); WriteItem(clone.Unclone()); } }
private void UncloneItem([NotNull] Item clone) { var cloneItem = new CloneItem(clone); cloneItem.Unclone(); }
public void RemoveItem(Transform Item, int Amount) { bool Removed = false; for (int a = 0; a < MaxItems; a++) //Starting a loop in the slots of the inventory: { if (Slots[a].IsTaken == true) //Checking if there's an item in this slot. { Item ItemScript = Slots[a].Item.GetComponent <Item>(); //Getting the item script from the items inside the bag. if (Slots[a].Item == Item) //Check if the item exists in the bag. { if (InvManager.DropType == InventoryManager.DropTypes.Spawn) { Transform CloneItem; //Create a temporary object to move the removed item to. CloneItem = (Transform)Instantiate(Item, Item.position, Item.rotation); //Clone the original item. Item Script = CloneItem.GetComponent <Item>(); //Get the item script. //Set the cloned item settings: Script.Amount = Amount; ItemScript.CurrencyAmount -= Amount * (ItemScript.CurrencyAmount / (ItemScript.Amount)); //Activate the cloned item and spawn it in real world. CloneItem.transform.GetComponent <Renderer>().enabled = true; CloneItem.transform.parent = null; CloneItem.transform.localPosition = Player.transform.localPosition; CloneItem.gameObject.SetActive(true); ItemScript.CurrencyAmount -= ItemScript.CurrencyAmount / ItemScript.Amount; ItemScript.Amount -= Amount; //Reduce the amount of the item inside the bag. InvManager.GetComponent <AudioSource>().PlayOneShot(InvManager.RemovedItem); //a sound if (ItemScript.Amount < 0 || ItemScript.Amount == 0) //If the amount goes below 0 or equal to 0. { //Remove the item from this slot. Slots[a].Item = null; Slots[a].IsTaken = false; Destroy(Item.gameObject); //Destroying the item. Removed = true; Items--; } Removed = true; } else if (InvManager.DropType == InventoryManager.DropTypes.Destroy) { ItemScript.CurrencyAmount -= Amount * (ItemScript.CurrencyAmount / (ItemScript.Amount)); ItemScript.Amount -= Amount; //Reduce the amount of the item inside the bag. InvManager.GetComponent <AudioSource>().PlayOneShot(InvManager.RemovedItem); //a sound. if (ItemScript.Amount < 0 || ItemScript.Amount == 0) //If the amount goes below 0 or equal to 0. { //Remove the item from this slot. Slots[a].Item = null; Slots[a].IsTaken = false; //Informing our player with: Destroy(Item.gameObject); //Destroying the item. Removed = true; Items--; } } } if (Removed) { Panel.RefreshItems(); if (SaveAndLoad == true) { SaveItems(); } return; } } } }