public void KeepItemtoInventory(ItemInteractiveGame Item) { Debug.Log("You selected the " + Item.GameData.Name); PlayerData.Inventory.Add(Item.ID_Item); InventoryManager.GetInstance().AddItem(Item.ID_Item); Destroy(Item.gameObject); }
private void MiniGameEvent() { if (CanClick && Input.GetMouseButtonDown(0)) { CanClick = false; RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1000.0f)) { Debug.DrawRay(transform.position, hit.point, Color.green); //sDebug.Log(hit.transform.gameObject); GameObject obj = hit.transform.gameObject; if (obj.GetComponent <ItemInteractiveGame>()) { ItemInteractiveGame item = obj.GetComponent <ItemInteractiveGame>(); KeepItemtoInventory(item); FindItemManager.GetInstance().UpdateFindItem(item.ID_Item); if (FindItemManager.GetInstance().FindItemAllComplete()) { CurrentMiniGame.GetRewardItem(); } } else if (obj.GetComponent <MiniGameTracker>()) { if (!obj.GetComponent <MiniGameTracker>().IsPuzzleComplete&& !obj.GetComponent <MiniGameTracker>().SpawnPuzzle&& CurrentMiniGame.IsComplete) { Debug.Log("Puzzle Start!"); RootMap.SetActive(false); CameraPlayer.SetCameraPuzzle(); UIManager.GetInstance().InventoryObject.SetActive(false); SetVisibleSmoke(false); obj.GetComponent <MiniGameTracker>().Puzzle.ParentMiniGame = obj; obj.GetComponent <MiniGameTracker>().SpawnPuzzle = true; obj.GetComponent <MiniGameTracker>().Puzzle.StartPuzzle(); } else if (CurrentMiniGame.IsComplete) { PuzzleComplete(obj); } else { } } //hit.transform.position += Vector3.right * speed * Time.deltaTime; // << declare public speed and set it in inspector } } else if (!CanClick && Input.GetMouseButtonUp(0)) { CanClick = true; } }