// Use this for initialization
 void Start()
 {
     if (dth == null)  //This happens to the script always exists, like it is static
     {
         dth = GameObject.FindGameObjectWithTag("GameController").GetComponent <DamageTextHandler>();
     }
 }
Exemplo n.º 2
0
 public override void HurtPlayer(float damage)
 {
     //GetComponent<SpriteRenderer>().color = Color.magenta;
     DamageTextHandler.makeDamageText(damage.ToString(), transform, 1f, "Player");
     hurt_sound.Play();
     currentHealth -= damage;
     StartCoroutine(HurtTime());
 }
 public virtual void HurtEnemy(float damage)
 {
     DamageTextHandler.makeDamageText(damage.ToString(), transform, 1f, "Enemy");
     if (chase_player != null)
     {
         chase_player.hurt = true;
     }
     else if (shoot_player != null)
     {
         //Debug.Log("hey i got hurt");
         shoot_player.hurt = true;
     }
     else if (boss != null)
     {
         boss.hurt = true;
     }
     //Debug.Log("Ouch I was hit");
     currentHealth         -= damage;
     healthImage.fillAmount = currentHealth / maxHealth;  // **wont do until ask nikhil
 }
Exemplo n.º 4
0
 public void HealPlayer(float heal)
 {
     DamageTextHandler.makeDamageText(heal.ToString(), transform, 1f, "Heal");
     currentHealth += heal;
 }
Exemplo n.º 5
0
 public virtual void HurtPlayer(float damage)
 {
     DamageTextHandler.makeDamageText(damage.ToString(), transform, 1f, "Player");
     currentHealth -= damage;
     StartCoroutine(HurtTime());
 }