Пример #1
0
        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);
        }
Пример #2
0
 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;
 }
Пример #3
0
        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);
        }
Пример #4
0
        // 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);
        }
Пример #5
0
 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;
 }
Пример #6
0
 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);
     }
 }
Пример #7
0
        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);
        }
Пример #8
0
 // for the unity editor
 public virtual void Reset(AttachStrategy strategy)
 {
 }
Пример #9
0
 public override void Reset(AttachStrategy strategy)
 {
     onAttachOptions.Reset();
     onDetachOptions.Reset();
 }