A game about forced loneliness, made by TACStudios
1using System.Collections; 2using System.Collections.Generic; 3 4namespace UnityEditor.ShaderGraph 5{ 6 [GenerationAPI] 7 internal class RenderStateCollection : IEnumerable<RenderStateCollection.Item> 8 { 9 public class Item : IConditional 10 { 11 public RenderStateDescriptor descriptor { get; } 12 public FieldCondition[] fieldConditions { get; } 13 public string value => descriptor.value; 14 15 public Item(RenderStateDescriptor descriptor, FieldCondition[] fieldConditions) 16 { 17 this.descriptor = descriptor; 18 this.fieldConditions = fieldConditions; 19 } 20 } 21 22 readonly List<Item> m_Items; 23 24 public RenderStateCollection() 25 { 26 m_Items = new List<Item>(); 27 } 28 29 public RenderStateCollection Add(RenderStateCollection renderStates) 30 { 31 foreach (RenderStateCollection.Item item in renderStates) 32 { 33 m_Items.Add(item); 34 } 35 36 return this; 37 } 38 39 public RenderStateCollection Add(RenderStateDescriptor descriptor) 40 { 41 m_Items.Add(new Item(descriptor, null)); 42 return this; 43 } 44 45 public RenderStateCollection Add(RenderStateDescriptor descriptor, FieldCondition fieldCondition) 46 { 47 m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition })); 48 return this; 49 } 50 51 public RenderStateCollection Add(RenderStateDescriptor descriptor, FieldCondition[] fieldConditions) 52 { 53 m_Items.Add(new Item(descriptor, fieldConditions)); 54 return this; 55 } 56 57 public IEnumerator<Item> GetEnumerator() 58 { 59 return m_Items.GetEnumerator(); 60 } 61 62 IEnumerator IEnumerable.GetEnumerator() 63 { 64 return GetEnumerator(); 65 } 66 } 67}