Exemplo n.º 1
0
    public void FinishPainting()
    {
        playerCharTransition.MakeTransition();
        DoneButton.SetActive(false);
        CameraController.camera.GetComponent <Es.InkPainter.Sample.MousePainter>().enabled = false;
        ReplayButton.SetActive(true);

        Texture texture = PaintWall.GetComponent <MeshRenderer>().materials[0].GetTexture("_BaseMap");

        RenderTexture.active = texture as RenderTexture;
        Texture2D tx = new Texture2D(texture.width, texture.height);

        tx.ReadPixels(new Rect(0, 0, tx.width, tx.height), 0, 0);
        tx.Apply();
        //Texture2D tx = texture as Texture2D;  // Texture2D.CreateExternalTexture(texture.width, texture.height, TextureFormat.RGBA32, true, false, texture.GetNativeTexturePtr());

        int redCount = 0;

        for (int x = 0; x < tx.width; x++)
        {
            for (int y = 0; y < tx.height; y++)
            {
                if (tx.GetPixel(x, y) == Color.red)
                {
                    redCount++;
                }
            }
        }
        float percent = redCount * 100 / (texture.width * texture.height);

        messager.ShowMessage("You've drawn " + percent + "% of the canvas", 10f);
        Debug.Log("You've drawn " + percent + "% of the canvas");
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        scoreText            = GameObject.Find("ScoreText").GetComponent <Text>();
        scoreText2           = GameObject.Find("ScoreText2").GetComponent <Text>();
        timeText             = GameObject.Find("TimeText").GetComponent <Text>();
        replayScoreText      = GameObject.Find("ReplayButtonText").GetComponent <Text>();
        scoreScript          = GameObject.Find("ScoreScript").GetComponent <ScoreScript>();
        gameControllerScript = GameObject.Find("GameControllerScript").GetComponent <GameControllerScript>();
        projectileScriptv2   = GameObject.Find("Projectile Group").GetComponent <ProjectileScriptv2>();
        slingshotScriptv2    = GameObject.Find("Slingshot Group").GetComponent <SlingshotScriptv2>();
        obstaclesScript      = GameObject.Find("Obstacles Group").GetComponent <ObstaclesScript>();
        background           = GameObject.Find("Background");
        selectChar           = GameObject.Find("Selectcharacter");

        CatSelect    = GameObject.Find("CatSelect");
        PigSelect    = GameObject.Find("PigSelect");
        BearSelect   = GameObject.Find("Bear");
        PandaSelect  = GameObject.Find("Panda");
        GameStarter  = GameObject.Find("StartButton");
        ReplayButton = GameObject.Find("ReplayButton");
        Logo         = GameObject.Find("Logo");
        GameStarter.SetActive(false);
        ReplayButton.SetActive(false);
        scoreText2.enabled = false;

        Plank = GameObject.Find("Seg6");
    }
Exemplo n.º 3
0
 public void ReplayCheck()
 {
     if (gameControllerScript.timeLeft <= 0)
     {
         ReplayButton.SetActive(true);
         background.SetActive(true);
         scoreText2.enabled = true;
     }
 }
Exemplo n.º 4
0
    void Start()
    {
        animator = this.GetComponent <Animator>();

        //Get a reference to the Rigidbody2D of the Bird
        rb2d = GetComponent <Rigidbody2D>();
        //Go right
        rb2d.velocity = Vector2.right * speed * Time.deltaTime;
        //Freeze time to wait for the player to press Play
        Time.timeScale = 0;
        ReplayButton.SetActive(false);

        //Set the initial velocity of our Bird
        rb2d.velocity = Vector2.right * speed * Time.deltaTime;
    }
Exemplo n.º 5
0
        private void Update()
        {
#if UNITY_IOS
            recording = ReplayKit.isRecording;
            //Debug.Log("ReplayKitRecorder#Update recording: " + recording + " error:" + ReplayKit.lastError);

            if (recording)
            {
                StopButton.SetActive(true);
                RecordButton.SetActive(false);
            }
            else
            {
                StopButton.SetActive(false);
            }

            // Check if theres any available recorded video
            if (ReplayKit.recordingAvailable)
            {
                ReplayButton.SetActive(true);
            }
            else
            {
                ReplayButton.SetActive(false);
            }

            if (preparingForRecording)
            {
                RecordCountdownButton.SetActive(true);
            }
            else
            {
                RecordCountdownButton.SetActive(false);
                if (!recording)
                {
                    RecordButton.SetActive(true);
                }
            }
#endif
        }
Exemplo n.º 6
0
    public void Replay()
    {
        CatSelect.SetActive(true);
        PigSelect.SetActive(true);
        BearSelect.SetActive(true);
        PandaSelect.SetActive(true);
        background.SetActive(true);
        selectChar.SetActive(true);
        Logo.SetActive(true);
        scoreText2.enabled = false;

        gameControllerScript.timeLeft = 60;
        ReplayButton.SetActive(false);

        Plank.GetComponent <Rigidbody2D>().rotation       = 0f;
        Plank.GetComponent <Rigidbody2D>().freezeRotation = true;
        Plank.GetComponent <Rigidbody2D>().velocity       = new Vector2(0, 0);

        /*gameControllerScript.gameStart = true;
         * gameControllerScript.timeLeft = 10;
         * gameControllerScript
         * ReplayButton.SetActive(false);
         */
    }
Exemplo n.º 7
0
 public void LevelFail()
 {
     messager.ShowMessage("Better Luck next time!", 3f);
     ReplayButton.SetActive(true);
 }