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/TwistyBandaged2Bar.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 TwistyBandaged2Bar extends TwistyBandagedAbstract
......
97 101

  
98 102
///////////////////////////////////////////////////////////////////////////////////////////////////
99 103
// PUBLIC API
104
// TODO
105
  public int randomizeNewRotAxis(Random rnd, int oldRotAxis)
106
    {
107
    int numAxis = ROTATION_AXIS.length;
108

  
109
    if( oldRotAxis == START_AXIS )
110
      {
111
      return rnd.nextInt(numAxis);
112
      }
113
    else
114
      {
115
      int newVector = rnd.nextInt(numAxis-1);
116
      return (newVector>=oldRotAxis ? newVector+1 : newVector);
117
      }
118
    }
119

  
120
///////////////////////////////////////////////////////////////////////////////////////////////////
121
// TODO
122

  
123
  public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis)
124
    {
125
    float rowFloat = rnd.nextFloat();
126

  
127
    for(int row=0; row<mRowChances.length; row++)
128
      {
129
      if( rowFloat<=mRowChances[row] ) return row;
130
      }
131

  
132
    return 0;
133
    }
134

  
135
///////////////////////////////////////////////////////////////////////////////////////////////////
100 136

  
101 137
  public int getObjectName(int numLayers)
102 138
    {

Also available in: Unified diff