protected ScopeComponent AddComponent(string name, SimpleTransform transform, Func <Vector3, Vector3> axisMap) { var component = new ScopeComponent(name, transform, axisMap); this.Components.Add(component); return(component); }
public void NotifyStateChange(ScopeComponent component, dynamic?data = null) { if (!Actions.ContainsKey(component)) { return; } Actions[component]?.Inline.Invoke(); Actions[component]?.Override?.Invoke(data); }
public KeyValuePair <ScopeComponent, ARScopeEntry> AddAction(ScopeComponent id, ARScopeEntry entry) { KeyValuePair <ScopeComponent, ARScopeEntry> pair = KeyValuePair.Create <ScopeComponent, ARScopeEntry>(id, entry); if (this.Actions.ContainsKey(id)) { return(pair); } this.Actions.Add(pair.Key, pair.Value); return(pair); }
public void AddIntoGroup(ScopeGroup group, ScopeComponent component, ARScopeEntry entry) { var elem = this.AddAction(component, entry); if (!Groups.ContainsKey(group)) { Groups.Add(group, new Dictionary <ScopeComponent, ARScopeEntry>()); } if (!Groups[group].ContainsKey(component)) { Groups[group].Add(elem.Key, elem.Value); } }
public static void DrawAxisGizmos(this ScopeComponent cmp, Transform parent) { var lineScale = cmp.Transform.Scale / 2f; var p1 = parent.position + (parent.rotation * cmp.Transform.Position); var rot = parent.rotation * cmp.Transform.Rotation; Gizmos.color = Color.red; Gizmos.DrawLine(p1, p1 + rot * Vector3.Scale(Vector3.right, lineScale)); Gizmos.color = Color.green; Gizmos.DrawLine(p1, p1 + rot * Vector3.Scale(Vector3.up, lineScale)); Gizmos.color = Color.blue; Gizmos.DrawLine(p1, p1 + rot * Vector3.Scale(Vector3.forward, lineScale)); }