public static Attachment AttachOneToOne(AttachStrategy strategy, GameObject object1, GameObject object2) { Attachment attachment = new Attachment(strategy, new AttachObject(object1, 0), new AttachObject(object2, 1)); attachment.Attach(); return(attachment); }
public Attachment(AttachStrategy strategy, AttachObjectList objects, int executionOrder = 0) { this.strategy = strategy; _executionOrder = executionOrder; ClingyComponent.instance.attachments.Add(new ClingyComponent.ExecutionOrder(_executionOrder), this); events.OnObjectConnected.AddListener(OnObjectConnected); events.OnObjectWillDisconnect.AddListener(OnObjectWillDisconnect); events.OnObjectLeft.AddListener(OnObjectLeft); this.objects = objects; }
public void GetProvidersFromStrategy(AttachStrategy strategy) { if (strategy == null) { return; } FieldInfo field = typeof(AttachStrategy).GetField("_selectedCategory", BindingFlags.NonPublic | BindingFlags.Instance); providers = strategy.GetProvidersForTransitioner((int)field.GetValue(strategy)); BuildLabels(strategy); }
// does not use the head/tail categories for now public static Attachment AttachChain(AttachStrategy strategy, params GameObject[] links) { AttachObject[] objects = new AttachObject[links.Length]; for (int i = 0; i < links.Length; i++) { objects[i] = new AttachObject(links[i], 1); } Attachment attachment = new Attachment(strategy, objects); attachment.Attach(); return(attachment); }
public void BuildLabels(AttachStrategy strategy) { if (providers.Length == 0 || strategy == null) { return; } labels = new string[providers.Length]; for (int i = 0; i < providers.Length; i++) { labels[i] = strategy.GetLabelForProvider(providers[i]); } hasLabels = true; }
public Attachment(AttachStrategy strategy, params AttachObject[] objects) { this.strategy = strategy; _executionOrder = executionOrder; ClingyComponent.instance.attachments.Add(new ClingyComponent.ExecutionOrder(_executionOrder), this); events.OnObjectConnected.AddListener(OnObjectConnected); events.OnObjectWillDisconnect.AddListener(OnObjectWillDisconnect); events.OnObjectLeft.AddListener(OnObjectLeft); this.objects = new AttachObjectList(); foreach (AttachObject obj in objects) { this.objects.Add(obj); } }
public static Attachment AttachManyToOne(AttachStrategy strategy, GameObject root, params GameObject[] leaves) { AttachObject[] objects = new AttachObject[leaves.Length + 1]; objects[0] = new AttachObject(root, 0); for (int i = 0; i < leaves.Length; i++) { objects[i + 1] = new AttachObject(leaves[i], 1); } Attachment attachment = new Attachment(strategy, objects); attachment.Attach(); return(attachment); }
// for the unity editor public virtual void Reset(AttachStrategy strategy) { }
public override void Reset(AttachStrategy strategy) { onAttachOptions.Reset(); onDetachOptions.Reset(); }