예제 #1
0
    public void SetupScene()
    {
        // update counts
        coinsCollected = 0;
        blocksCleared  = 0;
        score          = 0;
        highScore      = (highScore > score) ? highScore : score;
        uILogic.ChangeScore(score);
        uILogic.ChangeHighScore(highScore);

        // Create ramp
        rampObject = Instantiate(RampPrefab, new Vector3(0, 0, 0), Quaternion.identity);

        // reset path generator
        pathGenerator.SetupRamp(rampObject);
        while (pathGenerator.pathQueue.Peek() == null)
        {
            AddNewBlock();
        }

        // setup character
        ragDollObject.SetActive(false);
        characterObject.transform.position = new Vector3(2, 0, 1);
        characterObject.transform.rotation = Quaternion.identity;
        characterObject.GetComponent <CapsuleCollider>().height = 1.8f;
        characterObject.GetComponent <CapsuleCollider>().center = new Vector3(0, 0.9f, 0);
        characterObject.GetComponent <Animator>().Play("Idle", 0);
        characterObject.SetActive(true);

        // set UI panel to start
        uILogic.SetPanelActive(Panel.START);

        // set cameras
        ChangeCamera(CameraType.TPS);
    }