Show / Hide Table of Contents

Class EntityHealth

Used to keep track of the health of an enemy

Inheritance
object
Object
Component
Behaviour
MonoBehaviour
EntityHealth
Implements
IHittable
IExtraDamageable
IOnPool
Namespace: WeaverCore.Components
Assembly: WeaverCore.dll
Syntax
public class EntityHealth : MonoBehaviour, IHittable, IExtraDamageable, IOnPool

Fields

| Edit this page View Source

DeflectBlows

If true, it causes all attacks from the player to result in a massive clink and deflection. This is only used if invicible is set to true

Declaration
public bool DeflectBlows
Field Value
Type Description
bool
| Edit this page View Source

DoEffectsOnHit

If true, will play the enemy's hit effects when hit

Declaration
public bool DoEffectsOnHit
Field Value
Type Description
bool
| Edit this page View Source

EffectsOffset

Applies an offset to hit effects if desired

Declaration
public Vector3 EffectsOffset
Field Value
Type Description
Vector3
| Edit this page View Source

EvasionTime

Controls how often the enemy is able to receive attacks. For example, if the value is set to 0.15, then that means this enemy will not receive any more hits, until 0.15 seconds have elapsed since the last hit

Declaration
public float EvasionTime
Field Value
Type Description
float
| Edit this page View Source

GainSoul

If true, will cause the player to gain soul points when hit

Declaration
public bool GainSoul
Field Value
Type Description
bool
| Edit this page View Source

Invincible

Whether the enemy is invincible to attacks

Declaration
public bool Invincible
Field Value
Type Description
bool
| Edit this page View Source

LargeGeo

Declaration
public int LargeGeo
Field Value
Type Description
int
| Edit this page View Source

MediumGeo

Declaration
public int MediumGeo
Field Value
Type Description
int
| Edit this page View Source

SmallGeo

Declaration
[Space]
[Space]
[Header("Geo Dropped on Death")]
public int SmallGeo
Field Value
Type Description
int
| Edit this page View Source

impl

Declaration
protected HealthManager_I impl
Field Value
Type Description
HealthManager_I

Properties

| Edit this page View Source

EvasionTimeLeft

How much evasion time is left EvasionTime

Declaration
public float EvasionTimeLeft { get; set; }
Property Value
Type Description
float
| Edit this page View Source

Health

How much health the enemy has. This gets decreased each time the player hits this enemy

Declaration
public int Health { get; set; }
Property Value
Type Description
int
| Edit this page View Source

LastAttackDirection

The direction the last attack came from

Declaration
public CardinalDirection LastAttackDirection { get; }
Property Value
Type Description
CardinalDirection
| Edit this page View Source

LastAttackInfo

Contains info about the most recent hit on the enemy

Declaration
public HitInfo LastAttackInfo { get; }
Property Value
Type Description
HitInfo
| Edit this page View Source

Recoiler

The recoiler on the enemy. If a recoiler is attached to the object, then the enemy will recoil when hit

Declaration
public Recoiler Recoiler { get; set; }
Property Value
Type Description
Recoiler

Methods

| Edit this page View Source

AddHealthMilestone(int, Action)

Declaration
public void AddHealthMilestone(int health, Action action)
Parameters
Type Name Description
int health
Action action
| Edit this page View Source

AddModifier(IHealthModifier)

Adds a health modifier. The modifier will be used to modify how the health gets changed when the player hits the enemy

Declaration
public void AddModifier(IHealthModifier modifier)
Parameters
Type Name Description
IHealthModifier modifier

The modifier to be added

| Edit this page View Source

AddModifier<T>()

Adds a health modifier. The modifier will be used to modify how the health gets changed when the player hits the enemy

Declaration
public T AddModifier<T>() where T : IHealthModifier, new()
Returns
Type Description
T

Returns an instance of the modifier that was added

Type Parameters
Name Description
T

The type of health modifier to add

| Edit this page View Source

Awake()

Declaration
protected virtual void Awake()
| Edit this page View Source

Die()

Forces the entity to die

Declaration
public void Die()
| Edit this page View Source

Die(HitInfo)

Forces the entity to die

Declaration
public void Die(HitInfo finalHit)
Parameters
Type Name Description
HitInfo finalHit

The final hit on the entity

| Edit this page View Source

DoDeathEvent()

Calls the OnDeath Event, but does not change the health. This is if you only want to trigger the death event and nothing else

Declaration
public void DoDeathEvent()
| Edit this page View Source

DoDeathEvent(HitInfo)

Calls the OnDeath Event, but does not change the health. This is if you only want to trigger the death event and nothing else

Declaration
public void DoDeathEvent(HitInfo finalHit)
Parameters
Type Name Description
HitInfo finalHit

The final hit on the entity

| Edit this page View Source

GetDamageOfType(ExtraDamageTypes)

Declaration
public static int GetDamageOfType(ExtraDamageTypes extraDamageTypes)
Parameters
Type Name Description
ExtraDamageTypes extraDamageTypes
Returns
Type Description
int
| Edit this page View Source

HasModifier<T>()

Has a health modifier of the specific type been added?

Declaration
public bool HasModifier<T>()
Returns
Type Description
bool

Returns whether the modifier has been added

Type Parameters
Name Description
T

The type of health modifier to check for

| Edit this page View Source

HasModifier<T>(out T)

Has a health modifier of the specific type been added?

Declaration
public bool HasModifier<T>(out T modifier) where T : IHealthModifier
Parameters
Type Name Description
T modifier

If the modifier has been added, this will be a reference to the modifier that is added

Returns
Type Description
bool

Returns whether the modifier has been added

Type Parameters
Name Description
T

The type of health modifier to check for

| Edit this page View Source

Hit(HitInfo)

Hits the target. Returns true if the hit was valid and damage to the enemy was dealt

Declaration
public virtual bool Hit(HitInfo hit)
Parameters
Type Name Description
HitInfo hit

The hit on the enemy

Returns
Type Description
bool

Returns whether the hit was a valid hit or not

| Edit this page View Source

IsValidHit(HitInfo)

Checks if a hit on this enemy is valid

Declaration
public EntityHealth.HitResult IsValidHit(HitInfo hit)
Parameters
Type Name Description
HitInfo hit

The hit to check for

Returns
Type Description
EntityHealth.HitResult

Returns whether this hit is valid

| Edit this page View Source

NormalHit(HitInfo)

Declaration
protected virtual void NormalHit(HitInfo hit)
Parameters
Type Name Description
HitInfo hit
| Edit this page View Source

OnDeath(HitInfo)

Triggered when the entity dies

Declaration
protected virtual void OnDeath(HitInfo finalHit)
Parameters
Type Name Description
HitInfo finalHit

The final hit on the entity

| Edit this page View Source

OnPool()

Called when the object is sent back to a pool

Declaration
public virtual void OnPool()
| Edit this page View Source

PlayHitEffects(HitInfo, Player)

Declaration
public void PlayHitEffects(HitInfo hit, Player player = null)
Parameters
Type Name Description
HitInfo hit
Player player
| Edit this page View Source

PlayInvincibleHitEffects(HitInfo)

Declaration
public void PlayInvincibleHitEffects(HitInfo hit)
Parameters
Type Name Description
HitInfo hit
| Edit this page View Source

RemoveModifier(IHealthModifier)

Removes a health modifier

Declaration
public bool RemoveModifier(IHealthModifier modifier)
Parameters
Type Name Description
IHealthModifier modifier

The modifier to be removed

Returns
Type Description
bool

Returns true if the modifier has been successfully removed

| Edit this page View Source

RemoveModifier<T>()

Removes a modifier of the specified type

Declaration
public bool RemoveModifier<T>() where T : IHealthModifier
Returns
Type Description
bool

Returns true if the modifier has been successfully removed

Type Parameters
Name Description
T

The type of modifier to be removed

| Edit this page View Source

SetHealthRaw(int)

Sets the new health without triggering any IHealthModifiers, events, or milestones

Declaration
public void SetHealthRaw(int newHealth)
Parameters
Type Name Description
int newHealth

The new health value to set

| Edit this page View Source

Update()

Declaration
protected virtual void Update()

Events

| Edit this page View Source

OnDeathEvent

Called when the entity's health reaches zero

Declaration
public event Action<HitInfo> OnDeathEvent
Event Type
Type Description
Action<HitInfo>
| Edit this page View Source

OnHealthChangeEvent

Called when the entity's health has been modified

Declaration
public event EntityHealth.HealthChangeDelegate OnHealthChangeEvent
Event Type
Type Description
EntityHealth.HealthChangeDelegate

Implements

IHittable
IExtraDamageable
IOnPool

Extension Methods

ReflectionUtilities.ReflectCallMethod(object, string, object[], BindingFlags)
ReflectionUtilities.ReflectGetField(object, string, BindingFlags)
ReflectionUtilities.ReflectGetMethod(object, string, BindingFlags)
ReflectionUtilities.ReflectGetProperty(object, string, BindingFlags)
ReflectionUtilities.ReflectSetField(object, string, object, BindingFlags)
ReflectionUtilities.ReflectSetProperty(object, string, object, BindingFlags)
CoroutineUtilities.RunCoroutineWhile<T>(T, IEnumerator, Func<bool>)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾