Пример #1
0
        internal static bool Swap(this Stone[,] field, int2 lPos, int2 rPos)
        {
            if (field == null)
            {
                return(false);
            }
            if (!field.InRange(lPos) || !field.InRange(rPos))
            {
                return(false);
            }

            var ls = field.Get(lPos);
            var rs = field.Get(rPos);

            if (ls != null)
            {
                ls.position = rPos;
            }
            if (rs != null)
            {
                rs.position = lPos;
            }

            field.Set(rPos, ls);
            field.Set(lPos, rs);

            return(true);
        }