Question by 
               pearlplatinum · Jul 25, 2017 at 10:43 PM · 
                playerdamageenemydamagehealth  
              
 
              Why is my player not getting more damaged?
My player gets hurt when the enemy interacts with the player but doesn't do anymore damage afterwards
HurtPlayer Script: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class HurtPlayer : MonoBehaviour { public int damageToGive;
 // Use this for initialization
 public void OnTriggerEnter(Collider other){
     if(other.gameObject.tag == "Player") {
         other.gameObject.GetComponent<PlayerHealth> ().HurtPlayer (damageToGive);
 }
} }
PlayerHealth:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerHealth : MonoBehaviour { public int startingHealth; public int currentHealth;
 public float flashLength;
 private float flashCounter;
 public Renderer rend;
 public Color storedColor;
 // Use this for initialization
 void Start () {
     currentHealth = startingHealth;
     rend = GetComponent<Renderer>();
     storedColor = rend.material.GetColor("_Color");
 }
 
 // Update is called once per frame
 void Update () {
     if (currentHealth <= 0) {
         gameObject.SetActive (false);
     }
     if (flashCounter > 0) {
         flashCounter -= Time.deltaTime;
         if (flashCounter <= 0) {
             rend.material.SetColor ("_Color",storedColor);
         }
         }
     }
 public void HurtPlayer(int damageAmount){
     currentHealth-=damageAmount;
     flashCounter = flashLength;
     rend.material.SetColor ("_Color",Color.red);
 }
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                