Exemplo n.º 1
0
    // Start is called before the first frame update
    void Awake()
    {
        particles        = this.gameObject.GetComponentInChildren <ParticleSystem>();
        animator         = gameObject.GetComponent <Animator>();
        playerPresent    = false;
        platformRenderer = gameObject.GetComponent <SpriteRenderer>();
        InitialTimeLeft  = timeLeft;
        mCamera          = Camera.main;
        camHeight        = Mathf.Abs(Vector3.Distance(
                                         mCamera.ViewportToWorldPoint(new Vector3(0.5f, 0f, 10)),
                                         mCamera.ViewportToWorldPoint(new Vector3(0.5f, 1f, 10))
                                         ));

        Catformer.PlayerScript player = GameObject.FindGameObjectWithTag("Player").GetComponent <Catformer.PlayerScript>();
        if (player.GetScore() >= 160f)
        {
            timeLeft        = 2f;
            InitialTimeLeft = 2f;
        }
        else if (player.GetScore() >= 300f)
        {
            timeLeft        = 1f;
            InitialTimeLeft = 1f;
        }

        isLeaf = platformRenderer.sprite.name.Contains("Leaf");
    }
Exemplo n.º 2
0
    public void OnPlayerDeathTrigger()
    {
        int points = (int)playerRef.GetScore();

        deathOverlay.SetActive(true);
        pauseButton.SetActive(false);
        scoreText.GetComponent <Text>().text = "Score: " + points + "ft";
    }