public Vegetable(VegetableName vn) { Name = vn.ToString(); Price = VegetablePrice(vn); State = VegetableState.Fresh; prev = 0; }
public override void Interact(Inventory playerInventory) { base.Interact(playerInventory); this.playerInventory = playerInventory; playerVeggies = GetPlayerVeggieState(); bool isPlateEmpty = plateInventory.veggies.Count == 0; if (playerVeggies == VegetableState.Whole && isPlateEmpty) { DropVegetable(); } if (playerVeggies == VegetableState.None && !isPlateEmpty) { PickupVegetable(); } }
public override void Interact(Inventory playerInventory) { base.Interact(playerInventory); this.playerInventory = playerInventory; playerVeggies = GetPlayerVeggieState(); choppingBoardVeggies = GetChoppingBoardVeggieState(); switch (playerVeggies) { case VegetableState.Whole: // If the player is carrying a whole vegetable and the chopping board doesn't have any whole vegetables, place the vegetable on the chopping board. if (choppingBoardVeggies != VegetableState.Whole) { DropVegetable(); } break; case VegetableState.Chopped: // If the player is carrying a salad (chopped veggies), and the chopping board is empty, player can place salad back down on chopping board. if (choppingBoardVeggies == VegetableState.None) { DropSalad(); } break; case VegetableState.None: // If the player isn't carrying anything and there is a whole (unchopped) vegetable on the chopping board, chop the vegetable. if (choppingBoardVeggies == VegetableState.Whole) { ChopVegetable(); } else { // If the player isn't carrying anything, and there chopped vegetables on the chopping board, pick them up. PickupSalad(); } break; } }
public void StateToxic() { State = VegetableState.Toxic; }