void LateUpdate()
    {
        if (numberRopesCut == 2)
        {
            cutRopes = true;
            GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Movement_Cosmos>().JourneyStarted = true;
            GameObject.FindGameObjectWithTag("Ray").GetComponent <LineRenderer>().enabled = false;

            GameObject[] anchors = GameObject.FindGameObjectsWithTag("Anchor");

            for (int i = 0; i < anchors.Length; i++)
            {
                anchors[i].GetComponent <Destroy_Self>().enabled = true;
                for (int j = 0; j < anchors[i].transform.childCount; j++)
                {
                    anchors[i].transform.GetChild(j).GetComponent <Destroy_Self>().enabled = true;
                }
            }


            Tutorial_Manager TM = FindObjectOfType <Tutorial_Manager>();
            TM.TiltPhone = true;
            TM.StartPlayingTutorials();



            Destroy(GetComponent <TrailRenderer>());
            Destroy(this);
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        // if (halfWay)
        // {
        //  player.GetComponent<Player_Movement_Cosmos>().enabled = false;
        //  player.GetComponent<Rigidbody2D>().velocity = Vector3.zero;
        //  player.transform.rotation = Quaternion.Slerp(player.transform.rotation, Quaternion.identity, Time.deltaTime);

        //     player.transform.position = Vector2.MoveTowards(player.transform.position, points[waypoint].position, Time.deltaTime * player.GetComponent<Player_Movement_Cosmos>().risingSpeed);

        //     if(waypoint == 1){
        //         beam.GetComponent<Beam_Detection>().enabled = true;
        //     }else if(waypoint == 2){
        //         beam.GetComponent<Beam_Detection>().playerArrived = true;
        //     }

        //     if (waypoint < points.Length-1 && Vector2.Distance(player.transform.position, points[waypoint].transform.position) < 1f)
        //     {
        //         waypoint = (waypoint + 1);
        //     }
        // }

        if (player.transform.position.y >= transform.position.y - gameObject.GetComponent <Set_Position>().yBuffer)
        {
            fade = true;
            if (setTime == false)
            {
                startTime = Time.time;
                setTime   = true;

                GameObject.Find("Player").GetComponent <AudioManager>().Stop("Flame_Mid", true, 3f);
            }
        }

        if (fade)
        {
            if (fadeImage.color.a < 1f)
            {
                float t = (Time.time - startTime) / fadeTime;
                fadeImage.color = new Color(fadeImage.color.r, fadeImage.color.g, fadeImage.color.b, Mathf.SmoothStep(0, 1, t));
            }
            else
            {
                if (!_tutorialTriggered)
                {
                    _tutorialTriggered = true;

                    Tutorial_Manager TM = FindObjectOfType <Tutorial_Manager>();
                    TM.TiltPhone = false;
                    TM.CloseEyes = true;
                    TM.StartPlayingTutorials();
                }

                if (!_AudioTriggered)
                {
                    _AudioTriggered = true;

                    Invoke("StartAudio", startAudioSeconds);
                }

                if (!_GetRidOfObjects)
                {
                    _GetRidOfObjects = true;

                    Invoke("TurnOffObj", startAudioSeconds + 1f);
                }
            }
        }
    }