public void setItem(IItem item){ if (item == null){ chestIcon.enabled = true; } else { chestIcon.enabled = false; item.GameObject().transform.position = this.transform.position; } }
/// <summary> /// Called when an item has been dragged into the game zone. This methods checks the solution for this stage and calls the related events. /// </summary> public void OnItemPlacement(IItem placedItem){ CancelInvoke ("OnStageTimeout"); Debug.Log("Item Placed"); if (placedItem.Equals(CurrentStage.requiredItem)){ Debug.Log("Right Item!"); //The player selected the right item for this stage. Succeeded placedItem.GameObject().SetActive(false); GameManager.instance.StageSucceded(); } else { Debug.Log("Wrong Item!"); GameManager.instance.DropHealth(); GameManager.instance.isDragEnabled = true; placedItem.ResetPosition(); } }