Example #1
0
    void HideCG(string Parent)
    {
        GameObject MakeVisible = GameObject.Find(Parent);

        MakeVisible.GetComponent <Visibility>().visible = false;
        GameObject cm = GameObject.Find("Canvas_Manager");

        CGC = cm.GetComponent <CG_Controller>();
        CGC.HideCG(CGC.Puzzle_Tree_1);
        Invoke("_HideAlert", 5);
    }
Example #2
0
    void Update()
    {
        if (Entered == true)
        {
            if (Input.GetMouseButtonDown(0))
            {
                Vector2    wp   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                Collider2D coll = Collider.GetComponent <Collider2D>();
                if (coll.OverlapPoint(wp) && !EventSystem.current.IsPointerOverGameObject())
                {
                    audi_source.PlayOneShot(click_sound);
                    GameObject cm = GameObject.Find("Canvas_Manager");
                    CGC = cm.GetComponent <CG_Controller>();
                    switch (this.gameObject.name)
                    {
                    case "Interactable_Guide":
                        EnableDialog(coll);
                        break;

                    case "Interactable_Stack":
                        ////StartCoroutine(ExecuteAfterTime(4, "Puzzle_Stacks_1", CGC.Puzzle_Stacks_1));
                        ////EnableDialog(coll);
                        break;

                    case "Interactable_Shop":
                        if (PC.Store_Progress < 1)
                        {
                            StartCoroutine(ExecuteAfterTime(4, "Visibility", CGC.Puzzle_Store_1));
                            EnableDialog(coll);
                        }
                        if (PC.Store_Progress == 1)
                        {
                            StartCoroutine(ExecuteAfterTime(4, "Puzzle_Store_2", CGC.Puzzle_Store_2));
                            EnableDialog(coll);
                        }
                        if (PC.Store_Progress == 2 && PC.GotLogs == 0)
                        {
                            PC.CanGetLogs = true;
                            EnableDialog(coll);
                        }
                        if (PC.Store_Progress == 2 && PC.GotLogs == 1)
                        {
                            PC.CanGetLogs = true;
                            EnableDialog(coll);
                        }
                        if (PC.Store_Progress == 2 && PC.GotLogs == 2)
                        {
                            EnableDialog(coll);
                        }
                        break;

                    case "Interactable_Tree":    //
                        if (PC.Store_Progress == 2 && PC.GotLogs == 2)
                        {
                            StartCoroutine(ExecuteAfterTime(4, "Puzzle_Tree_1", CGC.Puzzle_Tree_1));
                            EnableDialog(coll);
                        }
                        break;

                    case "Interactable_Logs":
                        if (PC.Logs_Progress < 1 && PC.Store_Progress == 2 && PC.CanGetLogs == true)
                        {
                            StartCoroutine(ExecuteAfterTime(2, "Puzzle_Logs_1", CGC.Puzzle_Logs_1));
                            EnableDialog(coll);
                        }
                        if (PC.Logs_Progress == 1 && PC.Store_Progress == 2 && PC.CanGetLogs == true)
                        {
                            StartCoroutine(ExecuteAfterTime(2, "Puzzle_Logs_2", CGC.Puzzle_Logs_2));
                            EnableDialog(coll);
                        }
                        break;

                    case "Interactable_Guard":
                        if (Player.GetComponent <Player_Movement>().score >= 12)
                        {
                            SceneManager.LoadScene("End", LoadSceneMode.Single);
                        }
                        EnableDialog(coll);
                        break;
                    }
                }
            }
        }
    }