Connect() public static method

public static Connect ( Playable source, Playable target ) : bool
source Playable
target Playable
return bool
Beispiel #1
0
        public unsafe bool SetInputs(IEnumerable <Playable> sources)
        {
            for (int i = 0; i < this.inputCount; i++)
            {
                Playable.Disconnect(*((Playable *)this), i);
            }
            bool flag            = false;
            int  targetInputPort = 0;

            foreach (Playable playable in sources)
            {
                if (targetInputPort < this.inputCount)
                {
                    flag |= Playable.Connect(playable, *((Playable *)this), -1, targetInputPort);
                }
                else
                {
                    flag |= Playable.Connect(playable, *((Playable *)this), -1, -1);
                }
                this.node.SetInputWeight(targetInputPort, 1f);
                targetInputPort++;
            }
            for (int j = targetInputPort; j < this.inputCount; j++)
            {
                this.node.SetInputWeight(j, 0f);
            }
            return(flag);
        }
Beispiel #2
0
        public virtual bool SetInputs(IEnumerable <AnimationPlayable> sources)
        {
            int length = this.GetInputs().Length;

            for (int inputPort = 0; inputPort < length; ++inputPort)
            {
                Playable.Disconnect((Playable)this, inputPort);
            }
            bool flag = false;
            int  num  = 0;

            foreach (AnimationPlayable source in sources)
            {
                if (num < length)
                {
                    flag |= Playable.Connect((Playable)source, (Playable)this, -1, num);
                }
                else
                {
                    flag |= Playable.Connect((Playable)source, (Playable)this, -1, -1);
                }
                this.SetInputWeight(num, 1f);
                ++num;
            }
            for (int inputIndex = num; inputIndex < length; ++inputIndex)
            {
                this.SetInputWeight(inputIndex, 0.0f);
            }
            return(flag);
        }
        public virtual bool SetInputs(IEnumerable <AnimationPlayable> sources)
        {
            Playable[] inputs = base.GetInputs();
            int        num    = inputs.Length;

            for (int i = 0; i < num; i++)
            {
                Playable.Disconnect(this, i);
            }
            bool flag = false;
            int  num2 = 0;

            foreach (AnimationPlayable current in sources)
            {
                if (num2 < num)
                {
                    flag |= Playable.Connect(current, this, -1, num2);
                }
                else
                {
                    flag |= Playable.Connect(current, this, -1, -1);
                }
                base.SetInputWeight(num2, 1f);
                num2++;
            }
            for (int j = num2; j < num; j++)
            {
                base.SetInputWeight(j, 0f);
            }
            return(flag);
        }
Beispiel #4
0
        public bool SetInputs(IEnumerable <Playable> sources)
        {
            for (int i = 0; i < this.inputCount; i++)
            {
                Playable.Disconnect(this, i);
            }
            bool flag = false;
            int  num  = 0;

            foreach (Playable current in sources)
            {
                if (num < this.inputCount)
                {
                    flag |= Playable.Connect(current, this, -1, num);
                }
                else
                {
                    flag |= Playable.Connect(current, this, -1, -1);
                }
                this.node.SetInputWeight(num, 1f);
                num++;
            }
            for (int j = num; j < this.inputCount; j++)
            {
                this.node.SetInputWeight(j, 0f);
            }
            return(flag);
        }
Beispiel #5
0
 /// <summary>
 /// <para>Adds an Playable as an input.</para>
 /// </summary>
 /// <param name="input">The [[Playable] to connect.</param>
 /// <returns>
 /// <para>Returns the index of the port the playable was connected to.</para>
 /// </returns>
 public unsafe int AddInput(Playable input)
 {
     if (!Playable.Connect(input, *((Playable *)this), -1, -1))
     {
         throw new InvalidOperationException("AddInput Failed. Either the connected playable is incompatible or this AnimationPlayable type doesn't support adding inputs");
     }
     return(this.inputCount - 1);
 }
Beispiel #6
0
 /// <summary>
 ///   <para>Sets an AnimationPlayable as an input.</para>
 /// </summary>
 /// <param name="source">AnimationPlayable to be used as input.</param>
 /// <param name="index">Index of the input.</param>
 /// <returns>
 ///   <para>Returns false if the operation could not be completed.</para>
 /// </returns>
 public virtual bool SetInput(AnimationPlayable source, int index)
 {
     if (!this.CheckInputBounds(index))
     {
         return(false);
     }
     if (this.GetInputs()[index] != (Playable)null)
     {
         Playable.Disconnect((Playable)this, index);
     }
     return(Playable.Connect((Playable)source, (Playable)this, -1, index));
 }
Beispiel #7
0
 /// <summary>
 /// <para>Sets an Playable as an input.</para>
 /// </summary>
 /// <param name="source">Playable to be used as input.</param>
 /// <param name="index">Index of the input.</param>
 /// <returns>
 /// <para>Returns false if the operation could not be completed.</para>
 /// </returns>
 public unsafe bool SetInput(Playable source, int index)
 {
     if (!this.node.CheckInputBounds(index))
     {
         return(false);
     }
     if (this.GetInput(index).IsValid())
     {
         Playable.Disconnect(*((Playable *)this), index);
     }
     return(Playable.Connect(source, *((Playable *)this), -1, index));
 }
 /// <summary>
 ///   <para>Sets an AnimationPlayable as an input.</para>
 /// </summary>
 /// <param name="source">AnimationPlayable to be used as input.</param>
 /// <param name="index">Index of the input.</param>
 /// <returns>
 ///   <para>Returns false if the operation could not be completed.</para>
 /// </returns>
 public virtual bool SetInput(AnimationPlayable source, int index)
 {
     if (!base.CheckInputBounds(index))
     {
         return(false);
     }
     Playable[] inputs = base.GetInputs();
     if (inputs[index] != null)
     {
         Playable.Disconnect(this, index);
     }
     return(Playable.Connect(source, this, -1, index));
 }
        public bool SetInput(Playable source, int index)
        {
            bool result;

            if (!this.node.CheckInputBounds(index))
            {
                result = false;
            }
            else
            {
                if (this.GetInput(index).IsValid())
                {
                    Playable.Disconnect(this, index);
                }
                result = Playable.Connect(source, this, -1, index);
            }
            return(result);
        }
Beispiel #10
0
        public virtual bool SetInputs(IEnumerable <AnimationPlayable> sources)
        {
            int length = base.GetInputs().Length;

            for (int i = 0; i < length; i++)
            {
                Playable.Disconnect(this, i);
            }
            bool flag            = false;
            int  targetInputPort = 0;
            IEnumerator <AnimationPlayable> enumerator = sources.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    AnimationPlayable current = enumerator.Current;
                    if (targetInputPort < length)
                    {
                        flag |= Playable.Connect(current, this, -1, targetInputPort);
                    }
                    else
                    {
                        flag |= Playable.Connect(current, this, -1, -1);
                    }
                    base.SetInputWeight(targetInputPort, 1f);
                    targetInputPort++;
                }
            }
            finally
            {
                if (enumerator == null)
                {
                }
                enumerator.Dispose();
            }
            for (int j = targetInputPort; j < length; j++)
            {
                base.SetInputWeight(j, 0f);
            }
            return(flag);
        }
Beispiel #11
0
        public unsafe bool SetInputs(IEnumerable <Playable> sources)
        {
            for (int i = 0; i < this.inputCount; i++)
            {
                Playable.Disconnect(*((Playable *)this), i);
            }
            bool flag            = false;
            int  targetInputPort = 0;
            IEnumerator <Playable> enumerator = sources.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    Playable current = enumerator.Current;
                    if (targetInputPort < this.inputCount)
                    {
                        flag |= Playable.Connect(current, *((Playable *)this), -1, targetInputPort);
                    }
                    else
                    {
                        flag |= Playable.Connect(current, *((Playable *)this), -1, -1);
                    }
                    this.node.SetInputWeight(targetInputPort, 1f);
                    targetInputPort++;
                }
            }
            finally
            {
                if (enumerator == null)
                {
                }
                enumerator.Dispose();
            }
            for (int j = targetInputPort; j < this.inputCount; j++)
            {
                this.node.SetInputWeight(j, 0f);
            }
            return(flag);
        }
Beispiel #12
0
        public virtual bool SetInputs(IEnumerable <AnimationPlayable> sources)
        {
            Playable[] inputs = GetInputs();
            int        num    = inputs.Length;

            for (int i = 0; i < num; i++)
            {
                Playable.Disconnect(this, i);
            }
            bool flag = false;
            int  num2 = 0;

            foreach (AnimationPlayable source in sources)
            {
                flag = ((num2 >= num) ? (flag | Playable.Connect(source, this, -1, -1)) : (flag | Playable.Connect(source, this, -1, num2)));
                SetInputWeight(num2, 1f);
                num2++;
            }
            for (int j = num2; j < num; j++)
            {
                SetInputWeight(j, 0f);
            }
            return(flag);
        }
Beispiel #13
0
 /// <summary>
 ///   <para>Adds an AnimationPlayable as an input.</para>
 /// </summary>
 /// <param name="source">A playable to connect.</param>
 /// <returns>
 ///   <para>Returns the index of the port the playable was connected to.</para>
 /// </returns>
 public virtual int AddInput(AnimationPlayable source)
 {
     Playable.Connect((Playable)source, (Playable)this, -1, -1);
     return(this.GetInputs().Length - 1);
 }
Beispiel #14
0
 public static bool Connect(Playable source, Playable target)
 {
     return(Playable.Connect(source, target, -1, -1));
 }
 /// <summary>
 ///   <para>Adds an AnimationPlayable as an input.</para>
 /// </summary>
 /// <param name="source">A playable to connect.</param>
 /// <returns>
 ///   <para>Returns the index of the port the playable was connected to.</para>
 /// </returns>
 public virtual int AddInput(AnimationPlayable source)
 {
     Playable.Connect(source, this, -1, -1);
     Playable[] inputs = base.GetInputs();
     return(inputs.Length - 1);
 }