public virtual void GetHeal(int val) { stats.Heal(val); stateUI.Refresh(); if (gm.showDamageText) { var gObj = Instantiate(damageTextPrefab, transform.position, Quaternion.identity) as GameObject; DamageText dt = gObj.GetComponent <DamageText>(); dt.Init(val, Color.green); } audioManager.Play("Heal1"); }
void GetHit(int dmg) { stats.LowerHP(dmg); stateUI.Refresh(); if (stats.HP == 0 && IsAlive) { OnDeath(); } if (gm.showDamageText) { var gObj = Instantiate(damageTextPrefab, transform.position, Quaternion.identity) as GameObject; DamageText dt = gObj.GetComponent <DamageText>(); dt.Init(dmg, Color.black); } }
public void GetHit(int dmg) { activateGotHitTimer = true;//yohan added stats.LowerHP(dmg); stateUI.Refresh(); if (stats.HP == 0 && IsAlive) { OnDeath(); } if (gm.showDamageText) { var gObj = Instantiate(damageTextPrefab, transform.position, Quaternion.identity) as GameObject; DamageText dt = gObj.GetComponent <DamageText>(); dt.Init(dmg, Color.white); } FlashRed(); //yohan added OnInstantiateKindOfBlood(); //yohan added PlayGetHitSound(); }
public void GetHit(int dmg) { if (activeInvisible == true) { dmg = 0; } stats.LowerHP(Convert.ToInt32(dmg * 0.01 * (100 - stats.Defence))); // added by dohan------------------------------<<< check the code and delete the comment stateUI.Refresh(); stateUIFixe.Refresh(); //added yohan PlayGetHitSound(); if (stats.HP == 0 && IsAlive) { OnDeath(); } if (gm.showDamageText) { var gObj = Instantiate(damageTextPrefab, transform.position, Quaternion.identity) as GameObject; DamageText dt = gObj.GetComponent <DamageText>(); dt.Init(dmg, Color.red); } }
public int Team; // 0 = player , 1 = Ennemy void OnTriggerEnter(Collider OtherCollider) { Entity TrigEntity = OtherCollider.GetComponent <Entity>(); if (TrigEntity == null) { return; } if (Team != TrigEntity.GetTeam) { Attacker.OnHit(TrigEntity); int damagedone = TrigEntity.ReceiveAttack(damageOnTouch, Attacker); GameObject DamageHit = new GameObject("Damage Hit"); DamageHit.transform.SetParent(GameObject.Find("Canvas").transform); DamageText Script = DamageHit.AddComponent <DamageText>(); Script.Init(damagedone, OtherCollider.transform.position); //Create Hit } }