public void StartAdventure(Adventure adventure)
 {
     Items = new Inventory();
     Adventure = adventure;
     EnterStoryNode(Adventure.StartingPoint);
     RefreshUI();
 }
        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;
            }
        }
Exemple #3
0
 public bool CanChoose(Inventory current_inventory)
 {
     foreach (InventoryConditional conditional in Conditionals) {
         if (!conditional.Evaluate(current_inventory)) {
             return false;
         }
     }
     return true;
 }
        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 WorldView()
 {
     InitializeComponent();
     Items = new Inventory();
 }
 public void Selected(Inventory current_inventory)
 {
     foreach (InventoryOperation operation in OnEnter) {
         operation.Resolve(current_inventory);
     }
 }