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/TwistyBandagedFused.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 TwistyBandagedFused extends TwistyBandagedAbstract
......
99 103
///////////////////////////////////////////////////////////////////////////////////////////////////
100 104
// PUBLIC API
101 105

  
106
  public int randomizeNewRotAxis(Random rnd, int oldRotAxis)
107
    {
108
    int numAxis = ROTATION_AXIS.length;
109

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

  
121
///////////////////////////////////////////////////////////////////////////////////////////////////
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
///////////////////////////////////////////////////////////////////////////////////////////////////
136

  
102 137
  public int getObjectName(int numLayers)
103 138
    {
104 139
    return R.string.bandaged_fused;

Also available in: Unified diff