Creating Gun objects with upgrades?
- by zardon
I have a series of guns in my game. I use the Gun class/object like this:
(Just an example)
@interface Gun : NSObject
{
NSString *name; // Six-shooter
NSNumber *cost;
NSNumber *clipPrice; // ie: 700
NSNumber *clipCapacity; // 6
NSNumber *ammoCapacity; // 6
NSNumber *damage; // 0-10
NSNumber *accuracy; // 0-10
NSNumber *fireRate; // 0-10
NSNumber *range; // 0-10
// Not sure if I have all the stats, but this is fine for now
}
Lets say I want to have 3 upgrades per gun. My problem is I am not sure how to do this.
Examples:
increase fire-rate
increase range
increase accuracy
silencer
double ammo capacity (ie: Drum)
double clip capacity (ie: Taped magazine)
Thus my question is, I'd like to implement an upgrade system to guns but I am not sure how to do it.
Would there be an Upgrade object which is a child to the Gun class, or would it be seperate class altogether.
Thanks for your time.