File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,16 @@ class ESE_Queue<Class T>: Managed
7575 return value ;
7676 }
7777 // ----------------------------------------------------------------------------------------------------------- //
78+ bool TryEnqueue (T value )
79+ {
80+ if (Raw .Count () >= MaxSize )
81+ {
82+ return false;
83+ }
84+ Raw .InsertAt (value , 0 );
85+ return true;
86+ }
87+ // ----------------------------------------------------------------------------------------------------------- //
7888 bool TryDequeue (out T output )
7989 {
8090 int lastIndex = Raw .Count () - 1 ;
Original file line number Diff line number Diff line change 1+ class ESE_GetComponent < Class T >
2+ {
3+ static T FindFirst (IEntity ent )
4+ {
5+ return T .Cast (ent .FindComponent (T ));
6+ }
7+
8+ static array < T > FindAll (IEntity ent )
9+ {
10+ array < Managed > managedArray = {};
11+ ent .FindComponents (T , managedArray );
12+
13+ array < T > castedArray = {};
14+ foreach (Managed item : managedArray )
15+ {
16+ castedArray .Insert (T .Cast (item ));
17+ }
18+ return castedArray ;
19+ }
20+ }
21+ //------------------------------------------------------------------------------------------------
22+
23+ class ESE_InventoryHelper
24+ {
25+ static SCR_InventoryStorageManagerComponent GetInventoryStorageManager (IEntity ent )
26+ {
27+ return SCR_InventoryStorageManagerComponent .Cast (ent .FindComponent (SCR_InventoryStorageManagerComponent ));
28+ }
29+
30+ static array < ResourceName > GetItemResources (SCR_InventoryStorageManagerComponent manager )
31+ {
32+ if (!manager )
33+ return null ;
34+
35+ array < IEntity > entities = {};
36+ array < ResourceName > resources = {};
37+ if (manager .GetItems (entities ) > 0 )
38+ {
39+ foreach (IEntity item : entities )
40+ {
41+ resources .Insert (item .GetPrefabData ().GetPrefabName ());
42+ }
43+ }
44+ return resources ;
45+ }
46+ }
47+ //------------------------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments