# Projectile Data

Each [**Projectile**](https://infinitypbr.gitbook.io/magic-pig-games/projectile-factory/projectile-factory-documentation/projectile) has a `ProjectileData` object attached to it. Many behaviors will make use of the *Speed* value on this object, to determine how fast the Projectile should move. The demo scene also utilizes the *Damage* value.

{% hint style="info" %}
If you create your own **Movement Behavior** (or other [**Behaviors**](https://infinitypbr.gitbook.io/magic-pig-games/projectile-factory/projectile-factory-documentation/behaviors)), you do not have to make use of the data in **Projectile Data**. However, I would advise that you do utilize it, and also customize your own class which inherits from it, allowing more custom funcationality specific to your game.
{% endhint %}

Most likely you will want to create a new class which inherits from `ProjectileData`, and has additional data you need for your projectiles.

*Each game is unique.* **Projectile Factory** comes with the extensibility required to let you build **YOUR** game.

<figure><img src="https://2431624982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MY3N_li2jPq7az6mYfq%2Fuploads%2FColt00v3eNAN7Rd2NHbs%2FScreenshot%202024-03-03%20at%209.12.22%E2%80%AFPM.png?alt=media&#x26;token=b55fad30-1bc7-4fec-b515-f6c89a61a8ef" alt=""><figcaption></figcaption></figure>

This is the "*Fast Projectile*" in the demo scene, and some projectiles use this to move faster than others. The **Damage** value is used when a projectile collides with the **Demo Target**. Check the console, and the script, to see how.

## Custom Class Example

The ProjectileDataDemoDamageOverTime inherits from ProjectileData, and is used for demo projectiles like lasers and flame throwers, which likely cause damage over time rather than per collision.

```csharp
namespace MagicPigGames.Projectiles
{
    [CreateAssetMenu(fileName = "New Damage over Time Projectile Data", menuName = "Projectile System/Projectile Data - Demo Damage Over Time")]
    [System.Serializable]
    public class ProjectileDataDemoDamageOverTime : ProjectileData
    {
        protected override float CalculateDamage() => damage * Time.deltaTime;
    }
}
```

Here we update the `CreateAssetMenu` options, so that you can create new `Scriptable Objects` of this type, and override the `CalculateDamage()` method, multiplying it b y `Time.deltaTime`.

Your custom classes can go deeper, if you'd like, connecting your projectiles to your game data and stats, and even adding additional `Properties` that work with your custom [**Behaviors**](https://infinitypbr.gitbook.io/magic-pig-games/projectile-factory/projectile-factory-documentation/behaviors) specific to your game.
