Class Enemy
The base class for all enemies
Namespace: WeaverCore.Features
Assembly: WeaverCore.dll
Syntax
[RequireComponent(typeof(EntityHealth))]
public class Enemy : MonoBehaviourProperties
| Edit this page View SourceCurrentMove
The current move that is being run
Declaration
public IEnemyMove CurrentMove { get; }Property Value
| Type | Description | 
|---|---|
| IEnemyMove | 
DisableDamagersOnDeath
Should all PlayerDamager components be disabled when the enemy dies?
Declaration
public bool DisableDamagersOnDeath { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
HealthComponent
The enemy's EntityHealth
Declaration
public EntityHealth HealthComponent { get; }Property Value
| Type | Description | 
|---|---|
| EntityHealth | 
PreviousMove
The previous move that was run
Declaration
public IEnemyMove PreviousMove { get; }Property Value
| Type | Description | 
|---|---|
| IEnemyMove | 
Methods
| Edit this page View SourceAwake()
Called when the enemy awakes
Declaration
protected virtual void Awake()CancelCurrentMove()
Stops the CurrentMove
Declaration
public void CancelCurrentMove()IsBoundRoutineRunning(uint)
Checks if a bound routine is still running
Declaration
public bool IsBoundRoutineRunning(uint routineID)Parameters
| Type | Name | Description | 
|---|---|---|
| uint | routineID | The id of the bound routine | 
Returns
| Type | Description | 
|---|---|
| bool | Returns whether the routine is running | 
OnDeath()
Called when the enemy dies
Declaration
protected virtual void OnDeath()OnParry(IHittable, HitInfo)
Called when the enemy gets parried
Declaration
public virtual void OnParry(IHittable collider, HitInfo hit)Parameters
| Type | Name | Description | 
|---|---|---|
| IHittable | collider | The collider that recieved the parry | 
| HitInfo | hit | The hit info of the parried attack | 
Roar(float, bool)
Declaration
public IEnumerator Roar(float duration, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| float | duration | |
| bool | lockPlayer | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | 
Roar(float, AudioClip, bool)
Causes the enemy to emit a roar effect
Declaration
public IEnumerator Roar(float duration, AudioClip roarSound, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| float | duration | How long the roar will last | 
| AudioClip | roarSound | The sound that will be played during the roar | 
| bool | lockPlayer | Whether the player should be locked in place and be prevented from moving | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
Roar(float, Vector3, bool)
Causes the enemy to emit a roar effect
Declaration
public IEnumerator Roar(float duration, Vector3 spawnPosition, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| float | duration | How long the roar will last | 
| Vector3 | spawnPosition | The position the roar should be occuring at | 
| bool | lockPlayer | Whether the player should be locked in place and be prevented from moving | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
Roar(float, Vector3, AudioClip, bool)
Causes the enemy to emit a roar effect
Declaration
public IEnumerator Roar(float duration, Vector3 spawnPosition, AudioClip roarSound, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| float | duration | How long the roar will last | 
| Vector3 | spawnPosition | The position the roar should be occuring at | 
| AudioClip | roarSound | The sound that will be played during the roar | 
| bool | lockPlayer | Whether the player should be locked in place and be prevented from moving | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
Roar(GameObject, float, bool)
Causes an object to emit a roar effect
Declaration
public static IEnumerator Roar(GameObject source, float duration, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| GameObject | source | The object that is roaring | 
| float | duration | How long the roar will last | 
| bool | lockPlayer | Whether the player should be locked in place and be prevented from moving | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
Roar(GameObject, float, AudioClip, bool)
Causes an object to emit a roar effect
Declaration
public static IEnumerator Roar(GameObject source, float duration, AudioClip roarSound, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| GameObject | source | The object that is roaring | 
| float | duration | How long the roar will last | 
| AudioClip | roarSound | The sound that will be played during the roar | 
| bool | lockPlayer | Whether the player should be locked in place and be prevented from moving | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
Roar(GameObject, Vector3, float, bool)
Causes an object to emit a roar effect
Declaration
public static IEnumerator Roar(GameObject source, Vector3 spawnPosition, float duration, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| GameObject | source | The object that is roaring | 
| Vector3 | spawnPosition | The position the roar should be occuring at | 
| float | duration | How long the roar will last | 
| bool | lockPlayer | Whether the player should be locked in place and be prevented from moving | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
Roar(GameObject, Vector3, float, AudioClip, bool)
Causes an object to emit a roar effect
Declaration
public static IEnumerator Roar(GameObject source, Vector3 spawnPosition, float duration, AudioClip roarSound, bool lockPlayer = true)Parameters
| Type | Name | Description | 
|---|---|---|
| GameObject | source | The object that is roaring | 
| Vector3 | spawnPosition | The position the roar should be occuring at | 
| float | duration | How long the roar will last | 
| AudioClip | roarSound | The sound that will be played during the roar | 
| bool | lockPlayer | Whether the player should be locked in place and be prevented from moving | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
RunMove(IEnemyMove)
Runs a new move
Declaration
public IEnumerator RunMove(IEnemyMove move)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnemyMove | move | The move to run | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
RunMoveUntil(IEnemyMove, Func<bool>)
Runs a new move until the predicate returns true or when the move completes
Declaration
public IEnumerator RunMoveUntil(IEnemyMove move, Func<bool> predicate)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnemyMove | move | The move to run | 
| Func<bool> | predicate | The predicate used to stop the move when it returns false | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
RunMoveWhile(IEnemyMove, Func<bool>)
Runs a new move until the predicate returns false or when the move completes
Declaration
public IEnumerator RunMoveWhile(IEnemyMove move, Func<bool> predicate)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnemyMove | move | The move to run | 
| Func<bool> | predicate | The predicate used to stop the move when it returns false | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns an IEnumerator for use in a coroutine function | 
Remarks
Must be used in a coroutine function
StartBoundRoutine(IEnumerator)
Starts a bound coroutine. A bound coroutine is a coroutine that will automatically stop when the boss either dies or gets stunned
Declaration
public uint StartBoundRoutine(IEnumerator routine)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerator | routine | 
Returns
| Type | Description | 
|---|---|
| uint | Returns an id for stopping it | 
StartBoundRoutine(IEnumerator, Action)
Starts a bound coroutine. A bound coroutine is a coroutine that will automatically stop when the boss either dies or gets stunned
Declaration
public uint StartBoundRoutine(IEnumerator routine, Action onCancel)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerator | routine | The routine to run | 
| Action | onCancel | A function that's called when the routine gets cancelled | 
Returns
| Type | Description | 
|---|---|
| uint | Returns an id for stopping it | 
StopAllBoundRoutines()
Stops all bound routines
Declaration
public void StopAllBoundRoutines()StopBoundRoutine(uint)
Stops a bound routine
Declaration
public void StopBoundRoutine(uint routineID)Parameters
| Type | Name | Description | 
|---|---|---|
| uint | routineID | The id of the bound routine | 
StopCurrentMove()
Stops the CurrentMove without calling OnCancel()
Declaration
protected void StopCurrentMove()