Skip to main content

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.

Constructors​

MemberWhat it is
FixedImpactor()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected bool chargeOnEnableIf true, charges itself each time it's enabled.
protected bool isChargedOnStartWhether it starts charged.
7 private and internal fields
MemberWhat it is
private StatManager damageManagerOptional stat manager. If it has the damage stat, that stat's base value sets the hit multipliers.
private Stat damageStatThe damage stat found on damageManager in Initialize.
private NetworkEntity entityThe network entity this impactor syncs through.
private bool hasDamageStatWhether damageStat was found.
private bool hasInitializedTrue after Initialize. Charge changes are only sent to clients after this.
private BoolUnityEvent onChargedUpdateUnity event run with the new charged state whenever it changes.
private MethodSync syncChargedMethod sync the server uses to send the charged state to chunks or a joining player.

Properties​

MemberWhat 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​

MemberWhat 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
MemberWhat it is
private void OnEnable()Charges the impactor if chargeOnEnable is set.
private void Sync(IPlayer player, Stream stream)Writes the charged state, and on remote clients applies it and runs onChargedUpdate.

Used in​

Members of other types that take, return or hold a FixedImpactor: