Пример #1
0
        //***********************************************************************
        // Положить доминушку на стол
        //***********************************************************************
        private static bool SetBone(SBone sb, bool blnEnd)
        {
            SBone sbT;

            if (blnEnd)
            {
                sbT = lGame[lGame.Count - 1];
                if (sbT.Second == sb.First)
                {
                    lGame.Add(sb);
                    return(true);
                }
                if (sbT.Second == sb.Second)
                {
                    sb.Exchange();
                    lGame.Add(sb);
                    return(true);
                }
                return(false);
            }

            sbT = lGame[0];
            if (sbT.First == sb.Second)
            {
                lGame.Insert(0, sb);
                return(true);
            }
            if (sbT.First == sb.First)
            {
                sb.Exchange();
                lGame.Insert(0, sb);
                return(true);
            }
            return(false);
        }
Пример #2
0
 /// <summary>
 /// Returns an array of serializable bones from matching position and rotation arrays.
 /// </summary>
 /// <param name="bonePositions"> Unity Vector3 array of the positions of the bones. </param>
 /// <param name="boneRotations"> Unity Quaternion array of the rotations of the bones. </param>
 /// <param name="boneScales"> Unity Quaternion array of the relative scale of the bones. </param>
 /// <returns> An array of serilizable bones. </returns>
 public static SBone[] SerializeBones(Vector3[] bonePositions, Quaternion[] boneRotations, Vector3[] boneScales)
 {
     SBone[] bones = new SBone[bonePositions.Length];
     for (int i = 0; i < bonePositions.Length; i++)
     {
         bones[i] = new SBone(bonePositions[i], boneRotations[i], boneScales[i]);
     }
     return(bones);
 }
Пример #3
0
 /// <summary>
 /// Returns an array of serializable bones from a GameObject array.
 /// </summary>
 /// <param name="boneObjects"> Unity GameObject array of bones. </param>
 /// <returns> An array of serilizable bones. </returns>
 public static SBone[] SerializeBones(GameObject[] boneObjects)
 {
     SBone[] bones = new SBone[boneObjects.Length];
     for (int i = 0; i < boneObjects.Length; i++)
     {
         bones[i] = new SBone(boneObjects[i]);
     }
     return(bones);
 }
Пример #4
0
        //***********************************************************************
        // Получение случайной доминошки (sb) из базара
        // Возвращает FALSE, если базар пустой
        //***********************************************************************
        public static bool GetFromShop(out SBone sb)
        {
            int intN;

            sb.First = 7; sb.Second = 7;

            if (lBoneyard.Count == 0)
            {
                return(false);
            }

            // Подсчет количества взятых доминушек одним игроком за текущий ход
            intTaken += 1;
            // определяем случайным образом доминушку из базара
            intN = rnd.Next(lBoneyard.Count - 1);
            sb   = lBoneyard[intN];

            lBoneyard.RemoveAt(intN);            // удаляем ее из базара
            return(true);
        }