I’m working on a configurable weapon system that takes three parts: a fire pattern(an arc like a shotgun blast, three projectiles in a row, circluar pattern etc.), an ammo type (bullet, rocket, cheese etc.) and a weapon mod, which overwrites things like damage or rate of fire. I thought it would be a fairly simple task but i’m running into problems. I must be still half asleep or something…
My initial design is to have a ConfigurableWeapon class that has three fields: pattern, ammoType and mod. These fields are types of abstract class that you would inherit from for individual ammo types etc. The user would pick what they wanted from a list, then when the game starts the weapon would be set up. Also, the A.I. controlled enemies would use the same system, with pre-specified settings per enemy prefab.
I thought I would use a static helper class that has a dictionary that stores an enum as a key, and the type to be added as a value, then return new instances as needed but I can’t for the life of me get anything working this morning!
There’s probably a more elegant way of doing this, or i’m overlooking something obvious, so any suggestions would be appreciated.
I can post the code if needed, but seeming as i’m still trying to figure out the design it’s mostly just abstract class definitions and some inherited testing classes.