コード例 #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");
    }
コード例 #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");
    }
コード例 #3
0
 void Start()
 {
     fws = fws.GetComponent <Light>();
     ShowMovesButton.GetComponent <Button> ();
     PlayButton.GetComponent <Button> ();
     ReplayButton.GetComponent <Button> ();
     PlayButtonText      = PlayButton.transform.Find("Text").GetComponent <Text>();
     ShowMovesButtonText = ShowMovesButton.transform.Find("Text").GetComponent <Text> ();
     keimenaki           = omilia.transform.Find("omilia").GetComponent <Text> ();
     tip1                    = tip01.transform.Find("tip1").GetComponent <Text> ();
     tip2                    = tip02.transform.Find("tip2").GetComponent <Text> ();
     next                    = tip02.transform.Find("Symbol-forward").GetComponent <Text> ();
     previous                = tip01.transform.Find("Symbol-back").GetComponent <Text> ();
     ButtonBasic.enabled     = false;
     ButtonTurn.enabled      = false;
     ButtonPromenade.enabled = false;
     ButtonNewYork.enabled   = false;
     start.enabled           = false;
     omilia.enabled          = false;
     odhgies.enabled         = false;
     replay.enabled          = false;
     play.enabled            = false;
     end.enabled             = false;
     StartCoroutine("talk");
     StartCoroutine("emfanish");
     tip2.text     = "";
     previous.text = "";
     v             = moves.transform.position.y;
 }
コード例 #4
0
 public void ReplayCheck()
 {
     if (gameControllerScript.timeLeft <= 0)
     {
         ReplayButton.SetActive(true);
         background.SetActive(true);
         scoreText2.enabled = true;
     }
 }
コード例 #5
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;
    }
コード例 #6
0
ファイル: Game.cs プロジェクト: shruzberry/SongPong3D
    /**
     * Called when the Game starts
     */
    public bool Initialize(SongData song)
    {
        ResetGameTime();

        //OHCamera ohCam = FindObjectOfType<OHCamera>();
        inputMaster    = FindObjectOfType <InputHandler>().inputMaster;
        uIManager      = FindObjectOfType <UIManager>();
        songController = FindObjectOfType <SongController>();
        paddleManager  = FindObjectOfType <PaddleManager>();
        track          = FindObjectOfType <Track>();
        ballDropper    = FindObjectOfType <BallDropper>();

        // ENVIRONMENT
        track.Initialize(this);
        //ohCam.Initialize();

        // LOAD SONG
        this.songData = song;
        songController.Initialize(this, inputMaster);
        songController.LoadSong(song);
        songController.onSongEnd += EndGame;

        // PADDLES
        paddleManager.Initialize(this, track);

        // BALLS
        balls = LoadBallData(song.name);
        SortBalls();

        // BALL DROPPER
        ballDropper.Initialize(this, songController, track);
        ballDropper.ballMapName = song.songName;
        waitTimeBeats           = ballDropper.GetTimeToFallBeats();

        // UI
        uIManager.Initialize();
        replayButton = FindObjectOfType <ReplayButton>();
        replayButton.onReplayButtonClicked += RestartGame;

        StartGame();

        return(true);
    }
コード例 #7
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
        }
コード例 #8
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);
         */
    }
コード例 #9
0
 public void LevelFail()
 {
     messager.ShowMessage("Better Luck next time!", 3f);
     ReplayButton.SetActive(true);
 }