blob: d20fecb330f59e544384efa16f5b3abbd97a1848 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShiftOS.Objects
{
public class Shop
{
public string Name { get; set; }
public string Description { get; set; }
public List<ShopItem> Items { get; set; }
}
public abstract class ShopItem
{
public string Name { get; set; }
public string Description { get; set; }
public int Cost { get; set; }
public string ShopOwner { get; set; }
protected abstract void OnBuy();
protected abstract void GiveCPToShopOwner(int cp);
public bool Buy(ref Save buyer)
{
if(buyer.Codepoints >= Cost)
{
buyer.Codepoints -= Cost;
OnBuy();
GiveCPToShopOwner(Cost);
return true;
}
else
{
return false;
}
}
}
}
|