Project

General

Profile

« Previous | Next » 

Revision 38589947

Added by Leszek Koltunski over 2 years ago

Unify scrambling across all 4 bandaged objects.

View differences:

src/main/java/org/distorted/objects/TwistyBandagedFused.java
21 21

  
22 22
import android.content.res.Resources;
23 23

  
24
import org.distorted.helpers.ScrambleStateGraph;
24 25
import org.distorted.library.main.DistortedEffects;
25 26
import org.distorted.library.main.DistortedTexture;
26 27
import org.distorted.library.mesh.MeshSquare;
......
72 73
                      DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
73 74
    {
74 75
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN1, res, scrWidth);
76

  
77
    mStates = new ScrambleStateGraph[]
78
      {
79
      new ScrambleStateGraph( new int[][] {
80
                                           {0,-1,0, 0,1,0, 0,2,0, 2,-1,0, 2,1,0, 2,2,0},
81
                                           {0,-1,0, 0,1,0, 0,2,0, 2,-1,0, 2,1,0, 2,2,0},
82
                                           {0,-1,0, 0,1,0, 0,2,0, 2,-1,0, 2,1,0, 2,2,0},
83
                                          }
84
                            )
85
      };
75 86
    }
76 87

  
77 88
///////////////////////////////////////////////////////////////////////////////////////////////////
......
89 100
    }
90 101

  
91 102
///////////////////////////////////////////////////////////////////////////////////////////////////
92

  
93
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
94
    {
95
    if( curr==0 )
96
      {
97
      scramble[curr][0] = rnd.nextInt(NUM_AXIS);
98
      }
99
    else
100
      {
101
      int newVector = rnd.nextInt(NUM_AXIS -1);
102
      scramble[curr][0] = (newVector>=scramble[curr-1][0] ? newVector+1 : newVector);
103
      }
104

  
105
    float rowFloat = rnd.nextFloat();
106
    int numLayers = getNumLayers();
107

  
108
    for(int row=0; row<numLayers; row++)
109
      {
110
      if( rowFloat*numLayers <= row+1 )
111
        {
112
        scramble[curr][1] = row;
113
        break;
114
        }
115
      }
116

  
117
    switch( rnd.nextInt(4) )
118
      {
119
      case 0: scramble[curr][2] = -2; break;
120
      case 1: scramble[curr][2] = -1; break;
121
      case 2: scramble[curr][2] =  1; break;
122
      case 3: scramble[curr][2] =  2; break;
123
      }
124
    }
125

  
126
///////////////////////////////////////////////////////////////////////////////////////////////////
103
// PUBLIC APi
127 104

  
128 105
  public int getObjectName(int numLayers)
129 106
    {

Also available in: Unified diff