// the following logic arguments decide what cube to spawn. It was unclear whether I should only allow one gold to spawn ever, // or only one at a time, or only one in a row. I interpreted it to mean only spawn a gold cube if there aren't any gold cubes, // and also the last cube spawned wasn't a gold cube, so the player can't just keep clicking the gold cube. // regarding the return values, return will set lastSpawned to the relevant type, then pass that type back to whatever called the function. oreType oreToSpawn() { if (bronzeCount == 2 && silverCount == 2 && lastSpawned != oreType.Gold && goldCount == 0) { return(lastSpawned = oreType.Gold); } else if (bronzeCount < 4) { return(lastSpawned = oreType.Bronze); } else { return(lastSpawned = oreType.Silver); } }
float density, meltPoint, boilPoint, hardness, tensile, rigidity, conductance, attunement, resistance; //how well the material repels magical energy (this is not just a defensive stat) #endregion Fields #region Constructors /// <summary> /// Creates an entry of the <see cref="OreData"/> class. /// </summary> /// <param name="dens">The density of the material (g/m^3).</param> /// <param name="melt">Melting point in degrees K</param> /// <param name="boil">Boiling point in degrees K</param> /// <param name="hard">How well the material can take a hit</param> /// <param name="tens">How well the material absorbs a hit</param> /// <param name="rigi">How well the material holds a shape/point</param> /// <param name="cond">How well the material conducts electricity</param> /// <param name="attu">How well the material holds a magic charge</param> /// <param name="resi">How well the material repels magical energy</param> public OreItem(oreType o, float dens, float melt, float boil, float hard, float tens, float rigi, float cond, float attu, float resi) { itemID = o.GetHashCode() + 300; type = o; itemName = o.ToString(); itemType = ItemType.Resource; quantity = 0; density = dens; meltPoint = melt; boilPoint = boil; hardness = hard; tensile = tens; rigidity = rigi; conductance = cond; attunement = attu; resistance = resi; itemDesc = ""; quantity = 0; itemIcon = Resources.Load<Sprite>("ItemIcons/" + itemName); }
public OreItem(oreType oType, float ammount) { itemName = oType.ToString(); type = oType; }
// the following logic arguments decide what cube to spawn. It was unclear whether I should only allow one gold to spawn ever, // or only one at a time, or only one in a row. I interpreted it to mean only spawn a gold cube if there aren't any gold cubes, // and also the last cube spawned wasn't a gold cube, so the player can't just keep clicking the gold cube. // regarding the return values, return will set lastSpawned to the relevant type, then pass that type back to whatever called the function. oreType oreToSpawn() { if (bronzeCount == 2 && silverCount == 2 && lastSpawned != oreType.Gold && goldCount == 0) { return lastSpawned = oreType.Gold; } else if (bronzeCount < 4) { return lastSpawned = oreType.Bronze; } else return lastSpawned = oreType.Silver; }