public virtual void TakeDamage(float Damage, DamagerInflicter.WeaponTypes WeaponType = DamagerInflicter.WeaponTypes.Undefined) { //check invincibility, resistances and stuff if (true) { BloodSpatterSpawner.SpawnSmall(transform.position); Health -= Damage; if (UseSpriteManager) { spriteManager.TemporaryColor(new Color(1, 0, 0), 0.5f); } if (IsPlayer) { ScreenFx.InjuryScreen(); } if (Health <= 0) { Die(WeaponType); BloodSpatterSpawner.SpawnPool(transform.position); } } }
public virtual void Die(DamagerInflicter.WeaponTypes WeaponType = DamagerInflicter.WeaponTypes.Undefined) { DeathAnimation da = GetComponent <DeathAnimation>(); if (da != null) { da.Spawn(transform.position); } if (IsPlayer) { ScreenFx.DeathScreen(WeaponType); //as other scripts often reference player, destroying him would cause issues, so im just moving him away from any danger, hopefully //if id just kept him where he "dies", enemies would still attack him which would mess with cursor transform.position = new Vector3(NavTestStatic.MapWidth - 1, NavTestStatic.MapHeight - 1, 0); } else { Destroy(this.gameObject); } }