Setting up base classes for items, weapons, armor, consumables, etc.
Ran into an issue where it claims "does not have a constructor for this class with zero arguments.
See what is amiss please:
Item Base Class:
using UnityEngine;
using System.Collections;
public class Item
{
public int ID{get; set;}
public string Name{get; set;}
public string Description{get; set;}
public int Value{get; set;}
public int Weight{get; set;}
public bool Stackable{get; set;}
public string ModelPath{get; set;}
public Sprite Icon{get; set;}
}
Consumable:
using UnityEngine;
using System.Collections;
public class Consumable : Item
{
public int Uses{get; set;}
public Consumable(int Consumableid, string Consumablename, string Consumabledescription, int Consumablevalue, int Consumableweight, bool stackable, string modelPath, Sprite icon, int uses)
{
ID=Consumableid;
Name=Consumablename;
Description=Consumabledescription;
Value=Consumablevalue;
Weight=Consumableweight;
Stackable=stackable;
ModelPath=modelPath;
Icon=icon;
Uses=uses;
}
}
Missiles:
using UnityEngine;
using System.Collections;
public class Missiles : Consumable
{
string MissileType{get; set;} //arrow, bolt, rock, etc.
int MinDamage{get; set;}
int MaxDamage{get; set;}
public Missiles(int missileID, string missileName, string missileDescription, int missileValue, int missileWeight, bool stackable, string modelPath, Sprite icon, int missileUses, string missiletype, int mindamage, int maxdamage)
{
ID=missileID;
Name=missileName;
Description=missileDescription;
Value=missileValue;
Weight=missileWeight;
Stackable=stackable;
ModelPath=modelPath;
Icon=icon;
Uses=missileUses;
MissileType=missiletype;
MinDamage=mindamage;
MaxDamage=maxdamage;
}
}
Thanks in advanceā¦