Beispiel #1
0
 public void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "apple")
     {
         PlayerHealthManager.SetMaxHealth();
         Destroy(collision.gameObject);
     }
 }
Beispiel #2
0
 public void Restart()
 {
     gameWinMenuUI.SetActive(false);
     dj.PlayMenuEffect();
     dj.playerAlive = true;
     player.SetActive(true);
     playerHealth.SetMaxHealth();
     GameManager._instance.ResetBosses();
     SceneManager.LoadScene("Main");
 }
    // Use this for initialization
    void Start()
    {
        currentHp       = hpLevels[1];
        currentAttack   = attackLevels[1];
        currentDefense  = defenseLevels[1];
        thePlayerHealth = FindObjectOfType <PlayerHealthManager>();

        // Set health according to stats at start
        thePlayerHealth.playerMaxHealth = currentHp;
        thePlayerHealth.SetMaxHealth();
    }
    public void Restart()
    {
        gameOverMenuUI.SetActive(false);
        dj.PlayMenuEffect();
        dj.playerAlive = true;
        player.SetActive(true);
        playerHealth.SetMaxHealth();
        playerHealth.isAlive = true;
        GameManager._instance.ResetBosses();

        NoisePlayed = false;
        player.transform.position = playerSpawnPos.position;
        SceneManager.LoadScene("Main");
    }
Beispiel #5
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Player")
        {
            playerCntrl  = other.gameObject.GetComponent <PlayerController>();
            playerHealth = other.gameObject.GetComponent <PlayerHealthManager>();

            //Changes certain player values for the bossfight

            playerCntrl.playerMovementSpeed  = playerCntrl.playerMovementSpeed * 1.5f; //Increases player movementspeed in bossfight
            playerHealth.oxygenLossValue     = 0f;                                     //Stops decreasing of oxygen
            playerHealth.playerCurrentOxygen = playerHealth.playerMaxOxygen;
            playerHealth.SetMaxHealth();                                               //fills up health to max


            mainCamera.GetComponent <CameraFollow>().cameraZoom = 1.5f; //zooms the camera out

            boss.SetActive(true);
            bossSlider.SetActive(true);
        }
    }
 public void SetFullHealth()
 {
     PlayerHealth.SetMaxHealth();
 }