Convert current weapon MonoBehaviour to be ScriptableObject-based.
Currently the prototype Weapon script is MonoBehaviour
based, but as players will be able to choose their weapon (and each will have different characteristics/visuals) we'll need to switch it to be ScriptableObject
based.
We'll still have a Weapon MonoBehaviour
, but with this change we're essentially pulling the configuration and visuals out of the MonoBehaviour
so we can configure them within a ScriptableObject
.
The ScriptableObject
should follow the following abstract, with whatever necessary changes/additions are needed:
public abstract class WeaponConfig : ScriptableObject
{
// Example fields
public string name;
public float pushback;
public float cooldown;
public float aoeSize;
public Sprite sprite;
// We should have a setup function that we can call from the
// Weapon MonoBehaviour on Awake/Start, so the MonoBehaviour
// has the correct settings and configurations.
public abstract void SetupGameObject(GameObject entity);
}
The data API should probably be based off of the current WeaponState
struct, and this can probably be done in tandem with #9.
More information on the weapon configs and such can be found in the Game Design Doc, and some of the weapons ideas can also be found in the GDD.
-
Split Weapon configurations into their own ScriptableObject
-based class. -
Add MonoBehaviour setup method to ScriptableObject for runtime weapon MonoBehaviour
setup, etc. -
Create Weapon delegate MonoBehaviour