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/TwistyBandagedEvil.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 TwistyBandagedEvil extends TwistyBandagedAbstract
......
115 119

  
116 120
///////////////////////////////////////////////////////////////////////////////////////////////////
117 121
// PUBLIC API
122
// TODO
123
  public int randomizeNewRotAxis(Random rnd, int oldRotAxis)
124
    {
125
    int numAxis = ROTATION_AXIS.length;
126

  
127
    if( oldRotAxis == START_AXIS )
128
      {
129
      return rnd.nextInt(numAxis);
130
      }
131
    else
132
      {
133
      int newVector = rnd.nextInt(numAxis-1);
134
      return (newVector>=oldRotAxis ? newVector+1 : newVector);
135
      }
136
    }
137

  
138
///////////////////////////////////////////////////////////////////////////////////////////////////
139
// TODO
140

  
141
  public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis)
142
    {
143
    float rowFloat = rnd.nextFloat();
144

  
145
    for(int row=0; row<mRowChances.length; row++)
146
      {
147
      if( rowFloat<=mRowChances[row] ) return row;
148
      }
149

  
150
    return 0;
151
    }
152

  
153
///////////////////////////////////////////////////////////////////////////////////////////////////
118 154

  
119 155
  public int getObjectName(int numLayers)
120 156
    {

Also available in: Unified diff