Project

General

Profile

« Previous | Next » 

Revision 20898e6f

Added by Leszek Koltunski over 2 years ago

Convert both Dinos to the new, unified scrambling method.

View differences:

src/main/java/org/distorted/objects/TwistyDino.java
23 23

  
24 24
import org.distorted.helpers.ObjectShape;
25 25
import org.distorted.helpers.ObjectSticker;
26
import org.distorted.helpers.ScrambleStateGraph;
26 27
import org.distorted.library.main.DistortedEffects;
27 28
import org.distorted.library.main.DistortedTexture;
28 29
import org.distorted.library.mesh.MeshSquare;
29 30
import org.distorted.library.type.Static3D;
30 31
import org.distorted.library.type.Static4D;
31 32

  
33
import java.util.Random;
34

  
32 35
///////////////////////////////////////////////////////////////////////////////////////////////////
33 36

  
34 37
public abstract class TwistyDino extends TwistyObject
......
117 120
    mStickers[0] = new ObjectSticker(STICKERS[0],null,radii,stroke);
118 121
    }
119 122

  
123
  private int mCurrState;
124
  private int mIndexExcluded;
125
  ScrambleStateGraph[] mStates;
126

  
120 127
///////////////////////////////////////////////////////////////////////////////////////////////////
121 128

  
122 129
  TwistyDino(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
......
233 240
///////////////////////////////////////////////////////////////////////////////////////////////////
234 241
// PUBLIC API
235 242

  
243
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
244
    {
245
    if( curr==0 )
246
      {
247
      mCurrState     = 0;
248
      mIndexExcluded =-1;
249
      }
250

  
251
    int total = mStates[mCurrState].getTotal(mIndexExcluded);
252
    int random= rnd.nextInt(total);
253
    int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded);
254

  
255
    scramble[curr][0] = info[0];
256
    scramble[curr][1] = info[1];
257
    scramble[curr][2] = info[2];
258

  
259
    mCurrState     = info[3];
260
    mIndexExcluded = info[0];
261
    }
262

  
263
///////////////////////////////////////////////////////////////////////////////////////////////////
264

  
236 265
  public Static3D[] getRotationAxis()
237 266
    {
238 267
    return ROT_AXIS;

Also available in: Unified diff