> For the complete documentation index, see [llms.txt](https://cowsinss-organization.gitbook.io/fps-engine-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cowsinss-organization.gitbook.io/fps-engine-documentation/content/03.-content/03.3-player/weapon-states/weaponstatefactory.md).

# WeaponStateFactory

Contains all the available Weapon States.

{% hint style="info" %}
How can I add a new State?

First, make a new script that inherits from WeaponBaseState. Take a look at the provided example code:
{% endhint %}

```csharp
using UnityEngine;
namespace cowsins
{
    public class WeaponCustomState : WeaponBaseState
    {

        public WeaponCustomState (WeaponStates currentContext, WeaponStateFactory weaponStateFactory)
            : base(currentContext, weaponStateFactory) { }

        public override void EnterState()
        {
            // Do something on entering the state
        }

        public override void UpdateState()
        {
            CheckSwitchState();
        }

        public override void FixedUpdateState() { }

        public override void ExitState() {
            // Do something on exiting the state
        }

        public override void CheckSwitchState() { }

        public override void InitializeSubState() { }

    }
}
```

{% hint style="info" %}
Once you have this, we need to register this state in the WeaponStateFactory.cs as shown:
{% endhint %}

```csharp
public WeaponBaseState Die() { return new WeaponCustomState(_context, this); }
```

## List of Available WeaponStates

1. WeaponDefaultState
2. WeaponShootingState
3. WeaponReloadingState
4. WeaponInspectState
5. MeleeState
