Пример #1
0
 void UpdateHealthDisplay()
 {
     if (healthDisplay != null)
     {
         PlayerPrefs.SetInt("Health", health);
     }
     healthDisplay.UpdateHealthDisplay();
 }
Пример #2
0
 public void TakeDamage(int damageValue)
 {
     if (!immuneToDamage)
     {
         if (currentHealth - damageValue < 1)
         {
             currentHealth = 0;
             PlayerDeath(3f);
         }
         else
         {
             currentHealth -= damageValue;
             GetComponent <Animator>().SetTrigger("TakingDamage");
             print("taking damage");
             print(currentHealth);
         }
         immuneToDamage = true;
         Invoke("TurnOffDamageImmunity", 2f);             //cannot take damage more than once every 2 seconds
         healthDisplay.UpdateHealthDisplay();
     }
 }
Пример #3
0
	void UpdatePlayerValues(){
		player.doorwayMessage = doorwayMessage;
		player.levelThatDoorwayLeadsTo = levelThatDoorwayLeadsTo;
		player.highScoreMessage = highScoreMessage;
		player.levelListingMessage = levelListingMessage;
		player.speedMultiplier = speedMultiplier;
		player.highScoreMenu = highScoreMenu;
		player.levelListingMenu = levelListingMenu;
		player.settingsMenu = settingsMenu;
		player.helpMenu = helpMenu;
		player.currentState = currentState;
		Vector3 currentScale = player.transform.localScale;
		player.transform.localScale = new Vector3(currentScale.x*scaleMultiplier, currentScale.y*scaleMultiplier, currentScale.z);
		player.maxHealth = maxHealth;
		player.currentHealth = maxHealth;
		if(player.currentState != PlayerController.PlayerState.OutOfCombat) healthDisplay.UpdateHealthDisplay();
	}