-
Notifications
You must be signed in to change notification settings - Fork 0
/
Combo.cs
63 lines (51 loc) · 1.58 KB
/
Combo.cs
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Combo : MonoBehaviour {
public BaseIngredient leftSlot, rightSlot;
public delegate void ComboDelegate(Combo combo);
public static event ComboDelegate onImageChanged;
void Start () {
}
void Update () {
}
public bool IsShown (BaseIngredient ingredient) {
if (leftSlot == ingredient) return true;
if (rightSlot == ingredient) return true;
return false;
}
public void UnShow(BaseIngredient ingredient) {
if (leftSlot == ingredient) leftSlot = null;
if (rightSlot == ingredient) rightSlot = null;
if (onImageChanged != null) {
Debug.Log (name + " image unshown, listen up.");
onImageChanged.Invoke(this);
}
else Debug.Log (name + " image unshown, nobody cared.");
}
public bool ShowImage(BaseIngredient ingredient) {
if (ingredient == null) return false;
switch (ingredient.slot) {
default:
Debug.Log ("Doesn't know how to use slot " + ingredient.slot);
return false;
case ImageSlot.LeftSlot:
GlobalParty.chocolateInventory.Add(leftSlot); // UI Lists #9 at 7:00
leftSlot = ingredient;
break;
case ImageSlot.RightSlot:
GlobalParty.ingredientInventory.Add(rightSlot);
rightSlot = ingredient;
break;
// case ImageSlot.ComboSlot:
// comboSlot = ingredient;
// break;
}
if (onImageChanged != null) {
Debug.Log (name + " image change, listen up.");
onImageChanged.Invoke(this);
}
else Debug.Log (name + " image change, nobody cared.");
return true;
}
}