コード例 #1
0
    private void Start()
    {
        previewNr = Random.Range(0, 5);
        Application.targetFrameRate = 60;
        Time.fixedDeltaTime         = (1f / Application.targetFrameRate);
        Time.maximumDeltaTime       = (1.5f / Application.targetFrameRate);
        mainCamera = Camera.main;
        difficulty = 1;
        ballController.setBall(ball);
        followBall    = mainCamera.GetComponent <FollowBall>();
        ballTransform = ball.transform;
        ballRb        = ball.GetComponent <Rigidbody2D>();

        if (PlayerPrefs.GetInt("highScoreN") >= 1200)
        {
            extremeButton.interactable = true;
            extremeButtonInfo.gameObject.SetActive(true);
            extremeButtonInfoLocked.gameObject.SetActive(false);
            extremeButtonIngame.interactable = true;
            extremeButtonIngameInfo.gameObject.SetActive(true);
            extremeButtonIngameInfoLocked.gameObject.SetActive(false);
        }

        if (!PlayerPrefs.HasKey("lastDifficulty"))
        {
            PlayerPrefs.SetInt("lastDifficulty", 1);
        }
        highScoreSignE.transform.position = new Vector2(PlayerPrefs.GetFloat("highScoreEPosX"), -3.3f);
        highScoreSignN.transform.position = new Vector2(PlayerPrefs.GetFloat("highScoreNPosX"), -3.3f);
        highScoreSignX.transform.position = new Vector2(PlayerPrefs.GetFloat("highScoreXPosX"), -3.3f);

        switch (PlayerPrefs.GetInt("lastDifficulty"))
        {
        case 0:
            highScore.text     = PlayerPrefs.GetInt("highScoreE").ToString();
            score.color        = highScoreDiff.color = highScoreText.color = highScore.color = blue;
            highScoreDiff.text = "EASY";
            break;

        case 1:
            highScore.text     = PlayerPrefs.GetInt("highScoreN").ToString();
            score.color        = highScoreDiff.color = highScoreText.color = highScore.color = green;
            highScoreDiff.text = "NORMAL";
            break;

        case 2:
            highScore.text     = PlayerPrefs.GetInt("highScoreX").ToString();
            score.color        = highScoreDiff.color = highScoreText.color = highScore.color = red;
            highScoreDiff.text = "EXTREME";
            break;
        }
        if (PlayerPrefs.GetInt("achtakeable9") == 1 || PlayerPrefs.GetInt("ach9") == 1)
        {
            questionMarkButton.interactable = false;
        }
        intitializeAchievements();
        setRandomBallPreview();
        totalGemsText.text = PlayerPrefs.GetInt("totalGems").ToString();
    }
コード例 #2
0
 void Start()
 {
     ball            = ballController.getBall();
     fb              = ballController.getFollowball();
     uiController    = ballController.getUIController();
     timeController  = ballController.getTimeController();
     touchController = ballController.getTouchController();
     audioController = ballController.getAudioController();
     gameOverPanel   = ballController.getGameOverPanel();
     shopController  = ballController.getShopController();
     score           = ballController.getScore();
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        MakeWall(
            Vector3.up * Camera.main.orthographicSize,
            new Vector3(topWallLength, 1f, 1f),
            Quaternion.identity,
            true
            );
        recentObjectCreated.name = "Top Wall";
        FollowBall followScript = recentObjectCreated.AddComponent <FollowBall>();

        followScript.Init();
        ballScript.topWallFollowScript = followScript;
        MakeWall(
            Vector3.left * Camera.main.orthographicSize * Camera.main.aspect,
            new Vector3(sideWidth, Camera.main.orthographicSize * 2f, 1f),
            Quaternion.identity,
            true

            );

        MakeWall(
            Vector3.right * Camera.main.orthographicSize * Camera.main.aspect,
            new Vector3(sideWidth, Camera.main.orthographicSize * 2f, 1f),
            Quaternion.identity,
            true
            );


        MakeWall(
            new Vector3(0f, -Camera.main.orthographicSize + Camera.main.orthographicSize * paddle.allowedPlayArea, 1f),
            new Vector3(Camera.main.orthographicSize * 2f * Camera.main.aspect, Camera.main.orthographicSize * 2f * paddle.allowedPlayArea, 1f),
            Quaternion.identity,
            false
            );

        /*
         * MakeWall(
         *  Vector3.left * Camera.main.orthographicSize * Camera.main.aspect + Vector3.up * Camera.main.orthographicSize,
         *  new Vector3(2f, 1.5f, 1f),
         *  Quaternion.Euler(0f, 0f, 45f)
         *  );
         *
         * MakeWall(
         *  Vector3.right * Camera.main.orthographicSize * Camera.main.aspect + Vector3.up * Camera.main.orthographicSize,
         *  new Vector3(2f, 1.5f, 1f),
         *  Quaternion.Euler(0f, 0f, -45f)
         *  );
         */
    }
コード例 #4
0
ファイル: Wrap.cs プロジェクト: VoidAwake/Turn90
    void Start()
    {
        wrapChildLeft  = gameObject.transform.GetChild(0).gameObject.GetComponent <WrapChild>();
        wrapChildRight = gameObject.transform.GetChild(1).gameObject.GetComponent <WrapChild>();

        gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

        if (gameControllerObject == null)
        {
            Debug.Log("Could not find game controller object!");
        }
        else
        {
            gameControllerScript = gameControllerObject.GetComponent <GameController> ();

            followBallScript = gameControllerObject.GetComponent <FollowBall> ();
        }
    }
コード例 #5
0
ファイル: PlayerSelect.cs プロジェクト: gmfk07/Ball-Racer
    public Ball Populate(int playerNumber, GameObject type)
    {
        Vector3    pos        = new Vector3(0, 0, 0);
        GameObject obj        = Instantiate(type, pos, transform.rotation);
        Ball       ballScript = obj.GetComponent <Ball>();

        ballScript.startingLane = playerNumber;
        if (playerNumber == -1)
        {
            ballScript.player = 2;
            FollowBall follow = playerTwoCamera.GetComponent <FollowBall>();
            follow.target = obj.transform;
            PlayerTwo     = ballScript;
        }
        else
        {
            ballScript.player = 1;
            FollowBall follow = playerOneCamera.GetComponent <FollowBall>();
            follow.target = obj.transform;
            PlayerOne     = ballScript;
        }

        return(ballScript);
    }
コード例 #6
0
 // Start is called before the first frame update
 void Start()
 {
     camaraFollowBall = cameraFollow.GetComponent <FollowBall>();
 }
コード例 #7
0
 private void Start()
 {
     mainCamera     = Camera.main;
     timeController = mainCamera.GetComponent <TimeController>();
     followBall     = mainCamera.GetComponent <FollowBall>();
 }