BloodAndGore/Assets/Scripts/Enemies/Health.cs

24 lines
796 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2019-08-14 16:17:48 +02:00
using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Effects;
2019-08-14 16:17:48 +02:00
namespace Saltosion.OneWeapon.Enemies {
2019-08-07 20:03:51 +02:00
public class Health : MonoBehaviour {
public float MaxHealth;
public float CurrentHealth;
private PlayerFun PlayerFun;
private void Start() {
PlayerFun = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerFun>();
}
2019-08-14 21:31:58 +02:00
public void Damage(float amount, Vector2 fromDirection, bool applyPlayerDamageBoost) {
2019-08-04 20:09:00 +02:00
BloodLauncher.Splatter(transform.position, -fromDirection, (int)(amount), 100f, 100);
2019-08-14 21:31:58 +02:00
CurrentHealth -= amount * (1 + (applyPlayerDamageBoost ? PlayerFun.CurrentDamageBoost : 0.0f));
}
}
}