JetActor

JetActor is the basic building block of every actor in JetEngine. It acts as a single hub to bring together components such as JetPhysics, JetController, HP, attacks, and more. Either this or the Enemy class (which extends this) should be extended when writing classes for new actors.

Public Methods

public void Flash()

Makes the actor’s sprite flash white. This will flash every sprite slotted under Damaged Properties > Sprites To Flash.

public void Blink()

Causes the actor’s sprite to blink. This will blink every sprite slotted under Damaged Properties > Sprites To Flash.

public void StopBlink()

Stops the actor from blinking.

public virtual void NotifyOfWaterlineContact(CollisionType collisionType)

Called automatically by a Waterline if the player leaves or enters water. This method handles changing the actor to its land or water JetController is those are slotted.

public void SetController(JetController _controller)

This lets you swap out the actor’s existing controller for a new one. Among other things, this is used to give an actor separate controllers for land and water.

public virtual void OnAttackComplete()

Called automatically by Attack to notify the actor that it has finished its current attack.

public void RemoveControl()

Disables the actor’s input, if it has one.

public void RegainControl()

Enables the actor’s input, if it has one.

public bool IsAttacking()

Used to query if the actor has an attack which is currently active.

public void RestoreHP(int amount)

Used to restore HP to the actor if it has an Energy component slotted in its HP slot.

public void RestoreMP(int amount)

Used to restore Mp to the actor if it has an Energy component slotted in its MP slot.

public void DecrementMP(int amount)

Used to lower an actor’s MP by a given amount if it has an Energy component slotted in its MP slot.

public void Damage(int amount, bool willCauseKnockback = true, BattleEnums.DamageType damageType = BattleEnums.DamageType.Regular, Collider2D col = null)

Used to damage the actor; most typically called from collision with an enemy or projectile. Amount governs how much damage it takes. willCauseKnockback governs whether or not the attack can knock the actor back. damageType governs if the attack is considered a Regular or a Poison attack, with Poison being used for sustained damage over time attacks. col is passed the collider that dealt the damage to the actor to begin with.

public void Revive()

If the actor’s isDead is true, this method is used to bring them back to life, and set all of the appropriate parameters to put the actor back in the action, including maxing out its HP and enabling its physics and collider.

public void KillImmediately()

Immediately lowers the actor’s HP to 0 and kills it.

public virtual void OnStateChanged(JetState newState)

Called whenever the controller changes state. This can be overidden to have unique secondary effects when an actor changes to a particular state.

public virtual void OnStateEntered(JetState newState)

Called whenever the controller changes state. This can be overidden to have unique secondary effects when an actor changes to a particular state.

public virtual void OnStateExited(JetState newState)

Called whenever the controller changes state. This can be overidden to have unique secondary effects when an actor changes to a particular state.

public virtual void NotifyOfControllerJumping(int jumpNumber)

Called whenever the attached JetController’s JumpState begins. The jumpNumber argument indicates how many successive jumps have occurred without the actor landing. Can be overridden to display unique effects when double jumps occur and more.

public virtual void NotifyOfControllerJumpCresting()

Called when the attached JetController’s JumpState crests.

Protected Methods

protected virtual void OnDeath()

This can be overidden by the actor to have unique effects when the actor dies.

protected virtual void OnRevive()

This can be overidden by the actor to have unique effects when the actor is revived.

protected virtual void OnControllerChanged(JetController _newController)

This can be used to trigger specific effects when the controller changes.

protected virtual void OnEnterWater()

Can be overidden to have secondary effects play when the actor enters the water.

protected virtual void OnExitWater()

Can be overidden to have secondary effects play when the actor exits the water.

protected virtual void OnHit(int damageTaken, Collider2D col = null)

Can be overidden to have secondary effects play when the actor is hit.

protected virtual void OnBouncedOn(Collider2D col = null)

Can be overriden to have unique secondary effects when another actor bounces on this.

Public Members

public Attack currentAttack

The attack, if any, that the actor is currently performing.

public bool isBeingLoadedIntoNewScene

Used to temporarily freeze position while a new scene is loading. Called automatically by JetSceneManager.

public bool isDead

True while the actor is dead, and thus can’t move or be interacted with.

public WaterProperties waterProperties

Allows you to slot different JetControllers for while the actor is on land and in water, and set whether the actor will automatically switch between them.

public Invincibility invincibility

Properties relating to when the actor is invincible, and how they handle temporary invincibility after they take damage.

public DamagedProperties damagedProperties

Properties relating to how the actor reacts to taking damage.

public DeathProperties deathProperties

Properties relating to when the actor dies. Allows you to slot a particle to play on death, determine if the GameObject is automatically destroyed when the actor dies, and set whether the screen should shake.

public Energy hp

Slot an Energy component here for the actor’s HP, or Hit Points

public Energy mp

Slot an Energy component here for the actor’s MP, or Magic Points

public bool canBounceOn

If another actor’s Controller has a Bounce component, setting this to True allows them to bounce on this.

public Vector3 loadedIntoScenePoint

Used by JetSceneManager to know where to load the actor when a new room is entered.