public ResourcePool(ResourceTypes resourceType, int numUnits, float depletedRate) { switch (resourceType) { case ResourceTypes.Bauxite: Resource = new Bauxite(); break; case ResourceTypes.Hydrocarbons: Resource = new Hydrocarbons(); break; case ResourceTypes.Hydrogen: Resource = new Hydrogen(); break; case ResourceTypes.IronOre: Resource = new IronOre(); break; case ResourceTypes.Medicine: Resource = new Medicine(); break; case ResourceTypes.Organics: Resource = new Organics(); break; case ResourceTypes.Silica: Resource = new Silica(); break; case ResourceTypes.ThoriumOre: Resource = new ThoriumOre(); break; default: throw new Exception("Error: " + resourceType.ToString() + " not defined in ResourcePool constructor."); } Resource.AddResource(numUnits); DepletedRate = depletedRate; }
// Use this for initialization void Start() { mOrganicsResource = new Organics(); mOrganicsResource.SetIcon(GetComponent <SpriteRenderer>().sprite); }