Show / Hide Table of Contents

Class Enemy

The base class for all enemies

Inheritance
object
Object
Component
Behaviour
MonoBehaviour
Enemy
Boss
EnemyReplacement
Namespace: WeaverCore.Features
Assembly: WeaverCore.dll
Syntax
[RequireComponent(typeof(EntityHealth))]
public class Enemy : MonoBehaviour

Properties

| Edit this page View Source

CurrentMove

The current move that is being run

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

DisableDamagersOnDeath

Should all PlayerDamager components be disabled when the enemy dies?

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

HealthComponent

The enemy's EntityHealth

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

PreviousMove

The previous move that was run

Declaration
public IEnemyMove PreviousMove { get; }
Property Value
Type Description
IEnemyMove

Methods

| Edit this page View Source

Awake()

Called when the enemy awakes

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

CancelCurrentMove()

Stops the CurrentMove

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

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

| Edit this page View Source

OnDeath()

Called when the enemy dies

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

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

| Edit this page View Source

Roar(float, bool)

Declaration
public IEnumerator Roar(float duration, bool lockPlayer = true)
Parameters
Type Name Description
float duration
bool lockPlayer
Returns
Type Description
IEnumerator
| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

StopAllBoundRoutines()

Stops all bound routines

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

StopBoundRoutine(uint)

Stops a bound routine

Declaration
public void StopBoundRoutine(uint routineID)
Parameters
Type Name Description
uint routineID

The id of the bound routine

| Edit this page View Source

StopCurrentMove()

Stops the CurrentMove without calling OnCancel()

Declaration
protected void StopCurrentMove()

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
☀
☾