Class BasicEnemy
Inheritance
Object
Component
Behaviour
MonoBehaviour
BasicEnemy
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.useGUILayout
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.transform
Component.gameObject
Component.tag
Object.GetInstanceID()
Object.GetHashCode()
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags
Assembly: Assembly-CSharp.dll
Syntax
public class BasicEnemy : MonoBehaviour, IEnemy, IDamageTaker, IDamageEmitter
Fields
|
Edit this page
View Source
Animator
Animator for animation control
Declaration
[Header("Components")]
public Animator Animator
Field Value
| Type |
Description |
| Animator |
|
|
Edit this page
View Source
AttackCollider
Specifies the collider that will emit damage when it comes into contact with the enemy.
Declaration
[Tooltip("Specifies the collider that will emit damage when it comes into contact with the enemy.")]
public Collider2D AttackCollider
Field Value
| Type |
Description |
| Collider2D |
|
|
Edit this page
View Source
BodyCircleCollider
Collider responsible for collisions with walls, blocks, and bombs.
Declaration
[Tooltip("Body Collider responsible for collisions with walls, blocks, and bombs.")]
public CircleCollider2D BodyCircleCollider
Field Value
| Type |
Description |
| CircleCollider2D |
|
|
Edit this page
View Source
CanLookBack
Specifies whether the enemy can see behind and flip towards the player's direction.
Declaration
[Tooltip("Specifies whether the enemy can see behind and flip towards the player's direction.")]
public bool CanLookBack
Field Value
|
Edit this page
View Source
CharacterRigidBody
Character ridbody that collides in scenary walls and objects
Declaration
public Rigidbody2D CharacterRigidBody
Field Value
| Type |
Description |
| Rigidbody2D |
|
|
Edit this page
View Source
DamageBlinkDuration
Declaration
[Tooltip("Damage blink duration")]
public float DamageBlinkDuration
Field Value
|
Edit this page
View Source
DamageValue
Damage value inflicted on anyone that this enemy touches.
Declaration
[Tooltip("Damage value inflicted on anyone that this enemy touches.")]
public int DamageValue
Field Value
|
Edit this page
View Source
DeathSfx
Sound effect when this enemy dies.
Declaration
[Header("Sfx")]
[Tooltip("Sound effect when this enemy dies.")]
public AudioClipSpec DeathSfx
Field Value
|
Edit this page
View Source
DebugAnimatorCrossFades
Turns on animator crossfade debug
Declaration
[Tooltip("Turns on animator crossfade debug.")]
public bool DebugAnimatorCrossFades
Field Value
|
Edit this page
View Source
EggPrefab
If this enemy drops an egg upon death, specify it here; otherwise, leave it null.
Declaration
[Tooltip("If this enemy drops an egg upon death, specify it here; otherwise, leave it null.")]
public GameObject EggPrefab
Field Value
| Type |
Description |
| GameObject |
|
|
Edit this page
View Source
ForgetPlayerPositionWhenSeeingTheBomb
Specifies that the enemy will not use player evasion detection if there is a bomb in the way.
Declaration
[Tooltip("Specifies that the enemy will not use player evasion detection if there is a bomb in the way.")]
public bool ForgetPlayerPositionWhenSeeingTheBomb
Field Value
|
Edit this page
View Source
GenericDeathEffectPrefab
Prefab for generic death effect
Declaration
[Header("Prefabs")]
public GameObject GenericDeathEffectPrefab
Field Value
| Type |
Description |
| GameObject |
|
|
Edit this page
View Source
Health
Declaration
[Tooltip("Health")]
public int Health
Field Value
|
Edit this page
View Source
HittableLayer
Specifies the layer that is hittable.
Declaration
[Header("Attack")]
[Tooltip("Specifies the layer that is hittable.")]
public LayerMask HittableLayer
Field Value
| Type |
Description |
| LayerMask |
|
|
Edit this page
View Source
IdleToDownState
Animation state to cross fade to idle down animation
Declaration
[AnimatorStatesDropdown(0)]
public string IdleToDownState
Field Value
|
Edit this page
View Source
IdleToRightState
Animation state to cross fade to idle right animation
Declaration
[AnimatorStatesDropdown(0)]
public string IdleToRightState
Field Value
|
Edit this page
View Source
IdleToUpState
Animation state to cross fade to idle up animation
Declaration
[AnimatorStatesDropdown(0)]
public string IdleToUpState
Field Value
|
Edit this page
View Source
PlayerDetectionDistance
The distance at which the enemy is able to see the player
Declaration
[Range(0, 100)]
[Tooltip("The distance at which the enemy is able to see the player.")]
public float PlayerDetectionDistance
Field Value
|
Edit this page
View Source
ProbabilityToFlipOnIntersection
Smarter enemies turn at intersections, while the dumber ones go straight through. Select 100 for the first and zero for the second. Use a midpoint for the middle term
Declaration
[Header("Walk Cycle Tweaks")]
[Range(0, 100)]
[Tooltip("Smarter enemies turn at intersections, while the dumber ones go straight through. Select 100 for the first and zero for the second. Use a midpoint for the middle term.")]
public float ProbabilityToFlipOnIntersection
Field Value
|
Edit this page
View Source
ProbabilityToFollowPlayer
Smarter enemies follow the player, while the dumber ones ignore them and continue straight. Use 100 for the first, 0 for the second, and a midpoint for the middle term.
Declaration
[Range(0, 100)]
[Tooltip("Smarter enemies follow the player, while the dumber ones ignore them and continue straight. Use 100 for the first, 0 for the second, and a midpoint for the middle term.")]
public float ProbabilityToFollowPlayer
Field Value
|
Edit this page
View Source
ScorePoints
Points that the player earns when this enemy dies.
Declaration
[Tooltip("Points that the player earns when this enemy dies.")]
public int ScorePoints
Field Value
|
Edit this page
View Source
SpriteRenderer
The sprite renderer reference necessary to perform direction flips.
Declaration
[Tooltip("The sprite renderer necessary to perform direction flips.")]
public SpriteRenderer SpriteRenderer
Field Value
| Type |
Description |
| SpriteRenderer |
|
|
Edit this page
View Source
TimeToRememberPlayerPosition
Time in which the enemy is able to remember the player's position after losing sight of them.
Declaration
[Range(0, 100)]
[Tooltip("Time in which the enemy is able to remember the player's position after losing sight of them.")]
public float TimeToRememberPlayerPosition
Field Value
|
Edit this page
View Source
WaitBeforeChangeDirection
Time to wait before changing to another direction
Declaration
[Tooltip("Time to wait before changing to another direction.")]
public float WaitBeforeChangeDirection
Field Value
|
Edit this page
View Source
WalkSpeed
Declaration
[Tooltip("Walk speed.")]
public float WalkSpeed
Field Value
|
Edit this page
View Source
WalkingToDownState
Animation state to cross fade to walking down animation
Declaration
[AnimatorStatesDropdown(0)]
public string WalkingToDownState
Field Value
|
Edit this page
View Source
WalkingToRightState
Animation state to cross fade to walking right animation
Declaration
[Header("Animator States")]
[AnimatorStatesDropdown(0)]
public string WalkingToRightState
Field Value
|
Edit this page
View Source
WalkingToUpState
Animation state to cross fade to walking up animation
Declaration
[AnimatorStatesDropdown(0)]
public string WalkingToUpState
Field Value
|
Edit this page
View Source
_lastAnimatorState
Declaration
protected string _lastAnimatorState
Field Value
|
Edit this page
View Source
currentDirection
Direction where this character is walking
Declaration
protected Vector2 currentDirection
Field Value
|
Edit this page
View Source
dead
Indicates that this enemy has already been killed
Declaration
Field Value
|
Edit this page
View Source
flipSpriteHorizontally
If your sprite is inverted, use this.
Declaration
[Header("General Tweaks")]
[Tooltip("If your sprite is inverted, use this.")]
public bool flipSpriteHorizontally
Field Value
|
Edit this page
View Source
impassableLayerMask
Layermask corresponding to objects that cannot be passed through.
Declaration
protected LayerMask impassableLayerMask
Field Value
| Type |
Description |
| LayerMask |
|
|
Edit this page
View Source
lastSeenPlayer
Declaration
[SerializeField]
protected GameObject lastSeenPlayer
Field Value
| Type |
Description |
| GameObject |
|
|
Edit this page
View Source
lastSeenPlayerPosition
Last position the player was seen at
Declaration
[Header("Debug")]
[SerializeField]
protected Vector2? lastSeenPlayerPosition
Field Value
| Type |
Description |
| Vector2? |
|
|
Edit this page
View Source
playerEvasionDirection
Direction in which the player evaded
Declaration
[SerializeField]
protected Vector2? playerEvasionDirection
Field Value
| Type |
Description |
| Vector2? |
|
Methods
|
Edit this page
View Source
Die(IDamageEmitter)
Declaration
public void Die(IDamageEmitter emitter)
Parameters
|
Edit this page
View Source
Freeze(float)
Freezes this enemy. It is called when the player gets the time powerup
Declaration
public void Freeze(float duration)
Parameters
| Type |
Name |
Description |
| float |
duration |
|
|
Edit this page
View Source
FreezeAllActiveEnemies(float)
Freeze all enemies in the scene
Declaration
public static void FreezeAllActiveEnemies(float duration)
Parameters
| Type |
Name |
Description |
| float |
duration |
|
|
Edit this page
View Source
GetEmitter()
Method to catch the emitter. This exists because sometimes another object is responsible for the damage.
Declaration
public MonoBehaviour GetEmitter()
Returns
| Type |
Description |
| MonoBehaviour |
|
|
Edit this page
View Source
GetScorePointsForDeath()
Get how many points this enemy is worth
Declaration
public int GetScorePointsForDeath()
Returns
|
Edit this page
View Source
TakeDamage(DamageEmissionDto)
Takes damage and executes the blink process.
Declaration
public DamageResponseDto TakeDamage(DamageEmissionDto emission)
Parameters
Returns
|
Edit this page
View Source
WalkCycle()
Declaration
protected virtual IEnumerator WalkCycle()
Returns
Events
|
Edit this page
View Source
onDie
Event triggered when the enemy dies. This is used by the level manager for enemy counting.
Declaration
public event Action<BasicEnemy, IDamageEmitter> onDie
Event Type
Implements
Extension Methods