FixedImpactor
A class in Root.Township, Alta.Impact.
An impact source that only hurts while charged, such as a creature's beak or a seed projectile. The charged state syncs from server to clients.
- Listed in Items, inventory and logic
- Inherits or implements
ImpactGenerator,INetworkEntityBehaviour - Derived types
FixedImpactorGroup,PooledFixedImpactor
Constructors
| Member | What it is |
|---|---|
FixedImpactor() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected bool chargeOnEnable | If true, charges itself each time it's enabled. |
protected bool isChargedOnStart | Whether it starts charged. |
7 private and internal fields
| Member | What it is |
|---|---|
private StatManager damageManager | Optional stat manager. If it has the damage stat, that stat's base value sets the hit multipliers. |
private Stat damageStat | The damage stat found on damageManager in Initialize. |
private NetworkEntity entity | The network entity this impactor syncs through. |
private bool hasDamageStat | Whether damageStat was found. |
private bool hasInitialized | True after Initialize. Charge changes are only sent to clients after this. |
private BoolUnityEvent onChargedUpdate | Unity event run with the new charged state whenever it changes. |
private MethodSync syncCharged | Method sync the server uses to send the charged state to chunks or a joining player. |
Properties
| Member | What it is |
|---|---|
NetworkEntity Entity { get; } | The network entity it belongs to. |
bool IsCharged { get; private set; } | Whether it currently deals damage. |
override bool UpdatesPosition { get; } | Always false; it doesn't track its own movement. |
Methods
| Member | What it is |
|---|---|
void Charge() | Turns it on. Server: also syncs to clients. |
override AttackParameters GetCurrentAttack() | The attack it deals when charged, or an empty attack when not. |
override void GetFollowAndCurrent(ContactPointStructure contactPoint, out Vector3 follow, out Vector3 current, out float directionEffMod, out float generalEfficiency, out float directionMultiplier) | Builds the hit direction from the contact point when charged; gives -1 values when not charged. |
void Initialize() | Applies the starting charge, creates the sync and looks up the damage stat if a stat manager is set. |
void InitializeAsServer(SpawnData spawnData) | Does nothing. |
void OnConnected(Player player) | Sends the current charge state to a joining player. |
void OnDisconnected(Player player) | Does nothing. |
override void Reset() | Turns it off. Server: also syncs to clients. |
protected virtual void Awake() | Applies the starting charge state. |
2 private and internal methods
Used in
Members of other types that take, return or hold a FixedImpactor: