Example #1
0
    void Update()
    {
        if (Movement.isPortalsActivated)
        {
            Worlds_Bar.gameObject.SetActive(true);

            if (CurrentWorld == 0)
            {
                Left_Portal.GetComponent <Image>().sprite = PortalImages[2];
                LeftColor.sprite = WorldImages[2];

                CurrentColor.sprite = WorldImages[0];

                Right_Portal.GetComponent <Image>().sprite = PortalImages[1];
                RightColor.sprite = WorldImages[1];
            }
            else if (CurrentWorld == 1)
            {
                Left_Portal.GetComponent <Image>().sprite = PortalImages[0];
                LeftColor.sprite = WorldImages[0];

                CurrentColor.sprite = WorldImages[1];

                Right_Portal.GetComponent <Image>().sprite = PortalImages[2];
                RightColor.sprite = WorldImages[2];
            }
            else if (CurrentWorld == 2)
            {
                Left_Portal.GetComponent <Image>().sprite = PortalImages[1];
                LeftColor.sprite = WorldImages[1];

                CurrentColor.sprite = WorldImages[2];

                Right_Portal.GetComponent <Image>().sprite = PortalImages[0];
                RightColor.sprite = WorldImages[0];
            }
        }
    }
Example #2
0
    void Update()
    {
        AccelerometerMove();

        // Player Up
        if (rb.velocity.y > 0)
        {
            temp_height       = Player.transform.localPosition.y;
            isPlayerAscending = true;

            GenerateBlocks.Block_Hide();
            Player.GetComponent <Animator>().SetBool("isPlayerUp", true);
            Player.GetComponent <Animator>().SetBool("isPlayerDown", false);

            //Player.transform.Find("Down_Anim_Box").GetComponent<BoxCollider2D>().enabled = false;
            GameObject.Find("Down_Anim_Box").GetComponent <BoxCollider2D>().enabled = false;
        }

        // Player Down
        if (rb.velocity.y <= 0)
        {
            isPlayerAscending = false;
            GenerateBlocks.Block_Show();
            Player.GetComponent <Animator>().SetBool("isPlayerUp", false);
            Player.GetComponent <Animator>().SetBool("isPlayerDown", true);
            //Player.transform.Find("Down_Anim_Box").GetComponent<BoxCollider2D>().enabled = true;
            GameObject.Find("Down_Anim_Box").GetComponent <BoxCollider2D>().enabled = true;
        }

        // Current Score
        if (max_height < temp_height)
        {
            max_height     = temp_height;
            current_score += 10 * Score_Multiplier * PlayerData.Score_Multiplier_Power;
        }
        score.text = current_score.ToString("F0");

        if (!CameraMovement.Camera_Fall_Stop)
        {
            if (Player.transform.position.y > Item.transform.position.y)
            {
                Debug.Log("PASSED");
                Space_Img.SetActive(true);
            }
            else
            {
                Bg_LastPos = GameObject.Find("Background").transform.position = new Vector3(GameObject.Find("Background").transform.position.x, Player.transform.position.y - Player.transform.position.y / 18, 1);
            }
            Space_Img.transform.position = new Vector3(Space_Img.transform.position.x, Player.transform.position.y, 1);
        }
        else
        {
            GameObject.Find("Background").transform.position = new Vector3(GameObject.Find("Background").transform.position.x, GameObject.Find("Background").transform.position.y);
        }

        if (!isPortalsActivated)
        {
            Left_Portal.GetComponent <Image>().enabled  = false;
            Right_Portal.GetComponent <Image>().enabled = false;
        }
        else
        {
            Left_Portal.GetComponent <Image>().enabled  = true;
            Right_Portal.GetComponent <Image>().enabled = true;
        }
    }