Ejemplo n.º 1
0
 public void SetRotationIdWhenFlip()
 {
     if (rotationType == ERotationType.Square)
     {
         //shapeRotationId = (-shapeRotationId) % 6;
         shapeRotationId = ShapeInfo.mod(-shapeRotationId, 6);
     }
     else if (rotationType == ERotationType.Triangle)
     {
         //Debug.Log("Shape Move SetRotationIdWhenFlip" + " " + shapeRotationId);
         //shapeRotationId = GTangram.triangleFlipDic[shapeRotationId];
         //shapeRotationId = (-shapeRotationId) % 24;
         shapeRotationId = ShapeInfo.mod(-shapeRotationId, 24);
     }
     else //rotationType == ERotationType.Parallelogram
     {
         //shapeRotationId = GTangram.parallogramFlipDic[shapeRotationId];
         if (shapeRotationId >= 0)
         {
             //shapeRotationId = (-shapeRotationId) % 12 - 12;
             shapeRotationId = ShapeInfo.mod(-shapeRotationId, 12) - 12;
         }
         else //shapeRotationId < 0
         {
             //shapeRotationId = (-shapeRotationId) % 12;
             shapeRotationId = ShapeInfo.mod(-shapeRotationId, 12);
         }
     }
 }
Ejemplo n.º 2
0
    public void SetRotationId(bool isClockWise, int times = 1)
    {
        int clockWise = isClockWise ? 1 : -1;

        //Debug.Log("Shape Move ShapeInfo: " + "set rotation id");
        if (rotationType == ERotationType.Square)
        {
            //shapeRotationId = (shapeRotationId + clockWise) % 6;
            shapeRotationId = ShapeInfo.mod(shapeRotationId + clockWise * times, 6);
        }
        else if (rotationType == ERotationType.Triangle)
        {
            //shapeRotationId = (shapeRotationId + clockWise) % 24;
            shapeRotationId = ShapeInfo.mod(shapeRotationId + clockWise * times, 24);
        }
        else //rotationType == ERotationType.Parallelogram
        {
            if (shapeRotationId >= 0)
            {
                //shapeRotationId = (shapeRotationId + clockWise) % 12;
                shapeRotationId = ShapeInfo.mod(shapeRotationId + clockWise * times, 12);
            }
            else //shapeRotationId < 0
            {
                //shapeRotationId = (shapeRotationId + clockWise) % 12 - 12;
                shapeRotationId = ShapeInfo.mod(shapeRotationId + clockWise * times, 12) - 12;
            }
        }
    }