Script for a basic projectile that sets a target on fire rather than dealing a flat damage amount. Inherits from BasicProjectile.
Documentation updated 9/7/2024
- Author
- Stephen Nuttall
|
void | FlipDirection () |
|
virtual void | AwakeMethods () |
| Runs when Awake() is called.
|
|
virtual void | StartMethods () |
| Plays the spawn sound effect.
|
|
virtual void | OnTriggerEnterMethods (Collider2D collision) |
| Runs if the projectile collides with an object (and it's a trigger zone). Does nothing by default.
|
|
virtual void | OnCollisionEnterMethods (Collision2D collisionInfo) |
| Runs if the projectile collides with an object. Damages the object it collided with if possible, then destroys the projectile. - Parameters
-
collisionInfo | Represents the object the projectile collided with. |
|
|
void | UpdateFacing () |
| Flips the sprite and movement direction (if a compatable component for projectile movement is attached) depending on if the projectile is currently facing left or right.
|
|
GameObject | sprite |
| Reference to the game object that holds the sprite renderer of the projectile. Often this is just the projectile itself, but sometimes there's a child with the sprite. This allows compatability with both systems.
|
|
int | damage = 30 |
| The amount of damage the projectile will apply if it comes in contact with something it can damage.
|
|
bool | damagePlayers = true |
| If true, the projectile can damage the player.
|
|
bool | damageNonPlayers = true |
| If true, the projectile can damage objects that aren't the player (assuming they have an ObjectHealth component).
|
|
bool | destroyOnImpact = true |
| If true, the projectile will destroy itself when it hits something (regardless of if it can damage it or now).
|
|
EventReference | spawnSFX |
| Sound effect that plays when the projectile is spawned in.
|
|
bool | flipSprite = true |
| When facingLeft is true, the sprite will be flipped. Usually used to make the sprite "face the way the projectile is moving.".
|
|
int | refDamage [get, private set] |
| A mirror of damage that allows for other objects to read its value without changing it, and also allowing damage to appear in the Unity Editor.
|
|
bool | facingLeft = false [get, private set] |
| True if the projectile is facing (and thus moving) to the left. Likewise, false if the projectile is facing to the right.
|
|