Project

General

Profile

« Previous | Next » 

Revision eff371f4

Added by Leszek Koltunski about 3 years ago

Bandaged objects: first step making automatic scrambling work.

View differences:

src/main/java/org/distorted/objects/TwistyBandaged3Plate.java
27 27
import org.distorted.library.type.Static4D;
28 28
import org.distorted.main.R;
29 29

  
30
import java.util.Random;
31

  
32
import static org.distorted.effects.scramble.ScrambleEffect.START_AXIS;
33

  
30 34
///////////////////////////////////////////////////////////////////////////////////////////////////
31 35

  
32 36
class TwistyBandaged3Plate extends TwistyBandagedAbstract
......
103 107

  
104 108
///////////////////////////////////////////////////////////////////////////////////////////////////
105 109
// PUBLIC API
110
// TODO
111
  public int randomizeNewRotAxis(Random rnd, int oldRotAxis)
112
    {
113
    int numAxis = ROTATION_AXIS.length;
114

  
115
    if( oldRotAxis == START_AXIS )
116
      {
117
      return rnd.nextInt(numAxis);
118
      }
119
    else
120
      {
121
      int newVector = rnd.nextInt(numAxis-1);
122
      return (newVector>=oldRotAxis ? newVector+1 : newVector);
123
      }
124
    }
125

  
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127
// TODO
128

  
129
  public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis)
130
    {
131
    float rowFloat = rnd.nextFloat();
132

  
133
    for(int row=0; row<mRowChances.length; row++)
134
      {
135
      if( rowFloat<=mRowChances[row] ) return row;
136
      }
137

  
138
    return 0;
139
    }
140

  
141
///////////////////////////////////////////////////////////////////////////////////////////////////
106 142

  
107 143
  public int getObjectName(int numLayers)
108 144
    {

Also available in: Unified diff