-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActionPerform.cs
157 lines (139 loc) · 6.61 KB
/
ActionPerform.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class ActionPerform : MonoBehaviour
{
//public string CurrentActionBullet;
public string CurrentActionBullet;
public string ProcessName;
public bool Performing;
public float Progress;
public float TimeToPerform;
public int ItemID;
public GameObject ProgressBarUI;
public GameObject ProgressTextUI;
public GameObject ProgressGroupUI;
//Item Action Variables
public GameObject CurrentItem;
//public ItemAction_StatsEditorItem.WantedStat ItemAction_ActionBullet;
[System.Serializable]
public class EachStat
{
public ItemAction_StatsEditorItem.WantedStat StatName;
public float WantedAmount;
public EachStat(ItemAction_StatsEditorItem.WantedStat wantstat, float wala)
{
StatName = wantstat;
WantedAmount = wala;
}
}
public List<EachStat> WantedStats = new List<EachStat>();
void Update()
{
if (Performing == true)
{
DoingAction();
if (Progress > TimeToPerform)
{
Progress = TimeToPerform;
}
else if (Progress < 0)
{
Progress = 0;
}
ProgressGroupUI.SetActive(true);
}
else
{
ProgressGroupUI.SetActive(false);
}
}
void DoingAction()
{
/*switch (CurrentActionBullet)
{
case "ItemAction_StatsEditorItem":
switch (ItemAction_ActionBullet)
{
case ItemAction_StatsEditorItem.WantedStat.Health:
gameObject.GetComponent<Stats>().CharacterHealth += 1f * Time.deltaTime;
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
break;
case ItemAction_StatsEditorItem.WantedStat.Hunger:
gameObject.GetComponent<Stats>().CharacterHunger += 1f * Time.deltaTime;
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
break;
case ItemAction_StatsEditorItem.WantedStat.Thirst:
gameObject.GetComponent<Stats>().CharacterThirst += 1f * Time.deltaTime;
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
break;
case ItemAction_StatsEditorItem.WantedStat.Adrenaline:
gameObject.GetComponent<Stats>().CharacterAdrenaline += 1f * Time.deltaTime;
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
break;
case ItemAction_StatsEditorItem.WantedStat.Blood:
gameObject.GetComponent<Stats>().CharacterBlood += 1f * Time.deltaTime;
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
break;
case ItemAction_StatsEditorItem.WantedStat.Sanity:
gameObject.GetComponent<Stats>().CharacterSanity += 1f * Time.deltaTime;
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
break;
case ItemAction_StatsEditorItem.WantedStat.Energy:
gameObject.GetComponent<Stats>().CharacterEnergy += 1f * Time.deltaTime;
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
break;
}
break;
}*/
//if()
switch (CurrentActionBullet)
{
case "ItemAction_StatsEditorItem":
CurrentItem.GetComponent<ItemAction_StatsEditorItem>().ConsumedProgress = Progress;
ProgressTextUI.GetComponent<Text>().text = ProcessName + ": " + CurrentItem.gameObject.GetComponent<ItemCollisionDetection>().itemDataBase.GetComponent<ItemDatabase>().items[CurrentItem.GetComponent<ItemFunctionFoundation>().itmID].itemName;
foreach (EachStat ES in WantedStats)
{
switch (ES.StatName)
{
case ItemAction_StatsEditorItem.WantedStat.Health:
gameObject.GetComponent<Stats>().CharacterHealth += ES.WantedAmount * Time.deltaTime;
break;
case ItemAction_StatsEditorItem.WantedStat.Hunger:
gameObject.GetComponent<Stats>().CharacterHunger += ES.WantedAmount * Time.deltaTime;
break;
case ItemAction_StatsEditorItem.WantedStat.Thirst:
gameObject.GetComponent<Stats>().CharacterThirst += ES.WantedAmount * Time.deltaTime;
break;
case ItemAction_StatsEditorItem.WantedStat.Adrenaline:
gameObject.GetComponent<Stats>().CharacterAdrenaline += ES.WantedAmount * Time.deltaTime;
break;
case ItemAction_StatsEditorItem.WantedStat.Blood:
gameObject.GetComponent<Stats>().CharacterBlood += ES.WantedAmount * Time.deltaTime;
break;
case ItemAction_StatsEditorItem.WantedStat.Sanity:
gameObject.GetComponent<Stats>().CharacterSainity += ES.WantedAmount * Time.deltaTime;
break;
case ItemAction_StatsEditorItem.WantedStat.Energy:
gameObject.GetComponent<Stats>().CharacterEnergy += ES.WantedAmount * Time.deltaTime;
break;
}
}
break;
}
Progress += 1f * Time.deltaTime;
ProgressBarUI.GetComponent<RectTransform>().localScale = new Vector3(Progress / TimeToPerform, ProgressBarUI.GetComponent<RectTransform>().localScale.y);
}
public void StopAction()
{
Performing = false;
CurrentActionBullet = "";
Progress = 0;
TimeToPerform = 0;
ItemID = 0;
CurrentItem = null;
ProcessName = "";
WantedStats.Clear();
}
}