Project

General

Profile

« Previous | Next » 

Revision e4db5995

Added by Leszek Koltunski almost 5 years ago

Correct scramble speed.

View differences:

src/main/java/org/distorted/effect/BaseEffect.java
37 37
    {
38 38
    SIZECHANGE  ( 20, 1, R.string.sizechange_effect , SizeChangeEffect.class),
39 39
    SOLVE       ( 20, 1, R.string.solve_effect      , SolveEffect.class     ),
40
    SCRAMBLE    ( 30, 1, R.string.scramble_effect   , ScrambleEffect.class  ),
40
    SCRAMBLE    ( 60, 1, R.string.scramble_effect   , ScrambleEffect.class  ),
41 41
    WIN         ( 20, 1, R.string.win_effect        , WinEffect.class       ),
42 42
    ;
43 43

  
src/main/java/org/distorted/effect/scramble/ScrambleEffect.java
87 87

  
88 88
///////////////////////////////////////////////////////////////////////////////////////////////////
89 89

  
90
  abstract void createEffects(int duration);
90
  abstract void createEffects(int duration, int numScrambles);
91 91
  abstract void effectFinishedPlugin(final long effectID);
92 92

  
93 93
///////////////////////////////////////////////////////////////////////////////////////////////////
......
305 305
    mListener = renderer;
306 306

  
307 307
    int numScrambles = renderer.getNumScrambles();
308

  
309
    createBaseEffects(numScrambles*duration, numScrambles);
310
    createEffects(numScrambles*duration);
308
    int dura = (int)(duration*Math.pow(numScrambles,0.6f));
309
    createBaseEffects(dura,numScrambles);
310
    createEffects    (dura,numScrambles);
311 311

  
312 312
    if( mCubeEffectNumber==0 && mNodeEffectNumber==0 )
313 313
      {
src/main/java/org/distorted/effect/scramble/ScrambleEffectNone.java
28 28

  
29 29
public class ScrambleEffectNone extends ScrambleEffect
30 30
  {
31
  public void createEffects(int duration)
31
  public void createEffects(int duration, int numScrambles)
32 32
    {
33 33
    Dynamic3D d0 = new Dynamic3D(1,0.5f);
34 34
    d0.add(new Static3D(0,0,0));
src/main/java/org/distorted/effect/scramble/ScrambleEffectRotations.java
54 54

  
55 55
///////////////////////////////////////////////////////////////////////////////////////////////////
56 56

  
57
  public void createEffects(int duration)
57
  public void createEffects(int duration, int numScrambles)
58 58
    {
59 59
    mCubeEffectNumber   = 2;
60 60
    mNodeEffectNumber   = 0;
......
63 63

  
64 64
    mRnd.setSeed(System.currentTimeMillis());
65 65

  
66
    int numRandomPoints = (int)(Math.pow(numScrambles,0.7f));
67

  
66 68
    DynamicQuat dq = new DynamicQuat(duration, 0.5f);
67 69
    dq.setMode(Dynamic.MODE_PATH);
68 70
    dq.add(new Static4D(0,0,0,1));
69
    dq.add(generateNewRandomPoint());
70
    dq.add(generateNewRandomPoint());
71
    dq.add(generateNewRandomPoint());
71

  
72
    for(int point=0; point<numRandomPoints; point++)
73
      {
74
      dq.add(generateNewRandomPoint());
75
      }
76

  
72 77
    dq.add(new Static4D(0,0,0,1));
73 78

  
74 79
    mCubeEffects[0] = new MatrixEffectQuaternion(dq, new Static3D(0,0,0));
src/main/java/org/distorted/magic/RubikActivity.java
42 42
    private static final int[] button_ids  = {R.id.rubikSize2, R.id.rubikSize3, R.id.rubikSize4, R.id.rubikSize5};
43 43

  
44 44
    public static final int MIN_SCRAMBLE =  1;
45
    public static final int DEF_SCRAMBLE =  3;
46
    public static final int MAX_SCRAMBLE = 10;
45
    public static final int DEF_SCRAMBLE =  1;
46
    public static final int MAX_SCRAMBLE = 17;
47 47

  
48 48
    private static int mSize = DEFAULT_SIZE;
49 49
    private HorizontalNumberPicker mPicker;

Also available in: Unified diff