Esempio n. 1
0
    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;
        }
    }
Esempio n. 2
0
    public void PuzzleComplete(GameObject obj)
    {
        CurrentMiniGame = obj.GetComponent <MiniGameTracker>();
        RootMap.SetActive(true);
        UIManager.GetInstance().InventoryObject.SetActive(true);
        obj.GetComponent <MiniGameTracker>().IsPuzzleComplete = true;
        SetVisibleSmoke(true);
        CurrentMiniGame.Lighting.SetActive(false);
        CurrentMiniGame = obj.GetComponent <MiniGameTracker>();
        //GameManagement.GetInstance().MainCollisionActive(false);

        CameraPlayer.SetStateCamera(Quaternion.Euler(CurrentMiniGame.CameraPosition));
        CameraPlayer.SetTargetCamera(obj.GetComponent <MiniGameTracker>().TrckerCamera.transform);

        UIManager.GetInstance().SetVisibleFindItemBar(true);
        VisibleBackButton(false);
        CurrentMiniGame.Lighting.SetActive(true);
        if (CurrentMiniGame.IsComplete == false)
        {
            FindItemManager.GetInstance().SetListFindItem(CurrentMiniGame.ListFindItems);
        }
    }