Beispiel #1
0
        public override T GetSlotBehaviour <T> ()
        {
            if (CurrentSlot != null && CurrentSlot.Behaviours != null)
            {
                for (int i = 0; i < CurrentSlot.Behaviours.Length; i++)
                {
                    ItemSlotBehaviour behaviour = CurrentSlot.Behaviours[i];

                    if (behaviour.GetType() == typeof(T))
                    {
                        return((T)behaviour);
                    }
                }
            }

            if (Behaviours != null)
            {
                for (int i = 0; i < Behaviours.Length; i++)
                {
                    ItemSlotBehaviour behaviour = Behaviours[i];

                    if (behaviour.GetType() == typeof(T))
                    {
                        return((T)behaviour);
                    }
                }
            }
            return(null);
        }
Beispiel #2
0
		public virtual T GetSlotBehaviour<T> ()
			where T : ItemSlotBehaviour
		{
			for (int i = 0; i < Behaviours.Length; i++)
			{
				ItemSlotBehaviour behaviour = Behaviours[i];

				if (behaviour.GetType () == typeof (T))
				{
					return (T)behaviour;
				}
			}
			return null;
		}