Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit bb662db

Browse files
Extended runtimeset base functionality
1 parent 24794c7 commit bb662db

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public abstract class BaseRuntimeSet : SOArchitectureBaseObject, IEnumerable
6+
{
7+
public object this[int index]
8+
{
9+
get
10+
{
11+
return Items[index];
12+
}
13+
set
14+
{
15+
Items[index] = value;
16+
}
17+
}
18+
19+
public int Count { get { return Items.Count; } }
20+
21+
public abstract IList Items { get; }
22+
23+
IEnumerator IEnumerable.GetEnumerator()
24+
{
25+
return Items.GetEnumerator();
26+
}
27+
}

Assets/SO Architecture/Runtime Sets/BaseRuntimeSet.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SO Architecture/Runtime Sets/RuntimeSet.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,30 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44

5-
public class RuntimeSet<T> : SOArchitectureBaseObject, IEnumerable<T>
5+
public class RuntimeSet<T> : BaseRuntimeSet, IEnumerable<T>
66
{
7+
public new T this[int index]
8+
{
9+
get
10+
{
11+
return _items[index];
12+
}
13+
set
14+
{
15+
_items[index] = value;
16+
}
17+
}
18+
719
[SerializeField]
8-
protected List<T> _items = new List<T>();
20+
private List<T> _items = new List<T>();
921

10-
public int Count { get { return _items.Count; } }
22+
public override IList Items
23+
{
24+
get
25+
{
26+
return _items;
27+
}
28+
}
1129

1230
public void Add(T obj)
1331
{

0 commit comments

Comments
 (0)