public bool Evaluate(Inventory inv) { Item item = inv.GetItem(InventoryItem); switch (ComparisonOperator) { case Conditional.EqualTo: return(item.Value == Value); case Conditional.NotEqualTo: return(item.Value != Value); case Conditional.GreaterThan: return(item.Value > Value); case Conditional.GreaterThanOrEqualTo: return(item.Value >= Value); case Conditional.LessThan: return(item.Value < Value); case Conditional.LessThanOrEqualTo: return(item.Value <= Value); } throw new NotImplementedException("The comparison operation '" + ComparisonOperator + "' has not been implemented."); }
public void Resolve(Inventory inventory) { Item item = inventory.GetItem(ItemName); switch (Operation) { case Operation.Add: item.Value += Value; break; case Operation.Subtract: item.Value -= Value; break; case Operation.Set: item.Value = Value; break; case Operation.MakeVisible: item.Visible = true; break; case Operation.MakeInvisible: item.Visible = false; break; case Operation.MakeValueVisible: item.ValueVisible = true; break; case Operation.MakeValueInvisible: item.ValueVisible = false; break; } }
public void Resolve(Inventory inventory) { Item item = inventory.GetItem(ItemName); switch (Operation) { case Operation.Add: item.Value += Value; break; case Operation.Subtract: item.Value -= Value; break; case Operation.Set: item.Value = Value; break; case Operation.MakeVisible: item.Visible = true; break; case Operation.MakeInvisible: item.Visible = false; break; case Operation.MakeValueVisible: item.ValueVisible = true; break; case Operation.MakeValueInvisible: item.ValueVisible = false; break; } }
public bool Evaluate(Inventory inv) { Item item = inv.GetItem(InventoryItem); switch (ComparisonOperator) { case Conditional.EqualTo: return item.Value == Value; case Conditional.NotEqualTo: return item.Value != Value; case Conditional.GreaterThan: return item.Value > Value; case Conditional.GreaterThanOrEqualTo: return item.Value >= Value; case Conditional.LessThan: return item.Value < Value; case Conditional.LessThanOrEqualTo: return item.Value <= Value; } throw new NotImplementedException("The comparison operation '" + ComparisonOperator + "' has not been implemented."); }