コード例 #1
0
 /// <summary>
 /// Attempts tp remove one socketable item from this socketed one.
 /// </summary>
 /// <param name="thing">The socketable item being removed.</param>
 /// <returns><c>true</c> if the item was removed, <c>false</c> otherwise.</returns>
 public bool DetachSocketable(Socketable thing)
 {
     if (thing == null)
     {
         return(false);
     }
     for (int i = 0; i < Sockets.Length; i++)
     {
         if (Sockets[i].Store == thing)
         {
             Sockets[i].Store = null;
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        /// <summary>
        /// Attempts to attach one socketable item to this socketed one.
        /// </summary>
        /// <param name="receiver">The socketed item that will receive the other.</param>
        /// <param name="thing">The socketable item that will be attached.</param>
        /// <returns>The index of the socket array the socketable was stored in, or -1 if it was not stored.</returns>
        public Socket AttachSocketable(Socketable thing)
        {
            if (thing == null)
            {
                return(null);
            }

            //if (!thing.SocketId.Equals(SocketId)) return -1;
            var socket = GetFirstEmptySocket();

            if (socket != null)
            {
                socket.Store = thing;
                return(socket);
            }
            return(null);
        }