Class MobileUnit
Daggerfall mobile enemy. Handles loading resources and rendering object (i.e. a billboard) based on orientation and state. Note for implementors: an instance of a component extending this class can be added to a prefab named "DaggerfallMobileUnit" and bundled with a mod.
Namespace: DaggerfallWorkshop
Assembly: Assembly-CSharp.dll
Syntax
public abstract class MobileUnit : MonoBehaviour
Fields
| Improve this Doc View Sourcesummary
Declaration
[SerializeField]
protected MobileUnit.MobileUnitSummary summary
Field Value
Type | Description |
---|---|
MobileUnit.MobileUnitSummary |
Properties
| Improve this Doc View SourceClassicSpawnDistanceType
An index that defines spawn distance type.
Declaration
public abstract byte ClassicSpawnDistanceType { get; protected set; }
Property Value
Type | Description |
---|---|
Byte |
DoMeleeDamage
True if melee damage is scheduled to be performed, false otherwise. This is set by implementation when required during animation.
Declaration
public abstract bool DoMeleeDamage { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Enemy
Basic properties of this enemy.
Declaration
public abstract MobileEnemy Enemy { get; protected set; }
Property Value
Type | Description |
---|---|
MobileEnemy |
EnemyState
Current animation in progrees. Set with ChangeEnemyState(MobileStates).
Declaration
public abstract MobileStates EnemyState { get; protected set; }
Property Value
Type | Description |
---|---|
MobileStates |
FrameSpeedDivisor
Slow down the animation of this mobile unit by a divisor of frames per second. Used when enemies are slowed by spells etc.
Declaration
public abstract int FrameSpeedDivisor { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
FreezeAnims
True if animation shouldn't be performed, for example because enemy is paralyzed, false if animation should be performed as usual.
Declaration
public abstract bool FreezeAnims { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsBackFacing
True if enemy is facing away from player and might be backstabbed, false otherwise.
Declaration
public abstract bool IsBackFacing { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsSetup
True if enemy has been set, false otherwise.
Declaration
public abstract bool IsSetup { get; protected set; }
Property Value
Type | Description |
---|---|
Boolean |
ShootArrow
True if arrow shoot is scheduled to be performed, false otherwise. This is set by implementation when required during animation.
Declaration
public abstract bool ShootArrow { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
SpecialTransformationCompleted
True if special transformation is completed, false otherwise. See SetSpecialTransformationCompleted().
Declaration
public abstract bool SpecialTransformationCompleted { get; protected set; }
Property Value
Type | Description |
---|---|
Boolean |
Summary
Get the MobileUnitSummary data
Declaration
public MobileUnit.MobileUnitSummary Summary { get; }
Property Value
Type | Description |
---|---|
MobileUnit.MobileUnitSummary |
Methods
| Improve this Doc View SourceApplyEnemy(DaggerfallUnity)
Applies enemy properties. Implementation should perform setup for specific Enemy (for example load/instantiate objects and materials) and then start current animation (EnemyState).
Declaration
protected abstract void ApplyEnemy(DaggerfallUnity dfUnity)
Parameters
Type | Name | Description |
---|---|---|
DaggerfallUnity | dfUnity | Current instance of Daggerfall Unity. |
ApplyEnemyStateChange(MobileStates, MobileStates)
Applies change to enemy state. Implementation should perform transition to new animation (already assigned to EnemyState by caller).
Declaration
protected abstract void ApplyEnemyStateChange(MobileStates currentState, MobileStates newState)
Parameters
Type | Name | Description |
---|---|---|
MobileStates | currentState | Enemy state before the change. |
MobileStates | newState | Enemy state after the change. |
ChangeEnemyState(MobileStates)
Sets a new enemy state and restarts frame counter, if not freezed. Certain states are one-shot only (such as attack and hurt) and return to idle when completed. Continuous states (such as move) will keep looping until changed.
Declaration
public void ChangeEnemyState(MobileStates newState)
Parameters
Type | Name | Description |
---|---|---|
MobileStates | newState | New state. |
GetSize()
Gets size of enemy in scene.
Declaration
public abstract Vector3 GetSize()
Returns
Type | Description |
---|---|
Vector3 | 2D or 3D size of enemy object in scene. |
IsAttacking()
Gets true if playing any attack animation.
Declaration
public bool IsAttacking()
Returns
Type | Description |
---|---|
Boolean | True if playing attack animation. |
IsPlayingOneShot()
Gets true if playing a one-shot animation like attack and hurt.
Declaration
public bool IsPlayingOneShot()
Returns
Type | Description |
---|---|
Boolean | True if playing one-shot animation. |
OneShotPauseActionsWhilePlaying()
Gets true if motor should prevent action state changes while playing current oneshot anim.
Declaration
public bool OneShotPauseActionsWhilePlaying()
Returns
Type | Description |
---|---|
Boolean | True if motor should pause state changes while playing. |
SetEnemy(DaggerfallUnity, MobileEnemy, MobileReactions, Byte)
Sets enemy data for setup.
Declaration
public void SetEnemy(DaggerfallUnity dfUnity, MobileEnemy enemy, MobileReactions reaction, byte classicSpawnDistanceType)
Parameters
Type | Name | Description |
---|---|---|
DaggerfallUnity | dfUnity | Current instance of Daggerfall Unity. |
MobileEnemy | enemy | Basic properties of this enemy. |
MobileReactions | reaction | Reaction setting for this enemy. |
Byte | classicSpawnDistanceType | An index that defines spawn distance type. |
SetSpecialTransformationCompleted()
Set special transformation completed, e.g. Daedra Seducer into winged form. Used internally by mobile unit after playing seducer animations. Called when restoring save game if unit has raised transformation completed flag.
Declaration
public void SetSpecialTransformationCompleted()