// Start is called before the first frame update void Start() { GameObject player = GameObject.FindWithTag("Player"); TakingDamage getScene = player.GetComponent <TakingDamage>(); LevelPlayerDiedOnIndex = getScene.lvlPlayerDiedOn; }
void Update() { HeartNumber(); TakingDamage healthLoss = GetComponent <TakingDamage>(); maxHearts = healthLoss.maxHP; numberOfHearts = healthLoss.maxHP; hP = healthLoss.currentHP; Dead(); }
// Start is called before the first frame update public override void TakeDamage(float damage, GameObject attacker = null) { GameController.instance.DataStorage.EvilPlayerInfo.currenthealth -= damage; //base.TakeDamage(damage, attacker); if (GameController.instance.DataStorage.EvilPlayerInfo.currenthealth > 0) { enemyAnimator?.SetTrigger(Keys.TAKEDAMAGE_ANIM_KEY); } TakingDamage?.Invoke(); splashController?.MakeSplat(); if (FloatingText == true) { ShowFloatingText(damage); } if (GameController.instance.DataStorage.EvilPlayerInfo.currenthealth <= 0) { Die(); } EventController.instance.enemyEvents.CallOnEnemyGetDamage(this); EventController.instance.evilPlayerEvents.CallOnEvilPlayerReceiveDamage(damage, GameController.instance.DataStorage.EvilPlayerInfo.currenthealth); Debug.LogFormat("Evil player took damage {0}", damage); }