Project

General

Profile

« Previous | Next » 

Revision be7c9190

Added by Leszek Koltunski over 2 years ago

Abstract out some methods from the Movement classes. only two remain now: rowFromOffset and enabledAxis.

View differences:

src/main/java/org/distorted/objects/MovementDino.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import org.distorted.library.type.Static3D;
23

  
24 22
///////////////////////////////////////////////////////////////////////////////////////////////////
25 23

  
26
class MovementDino extends Movement
24
class MovementDino extends Movement6
27 25
{
28
  static final float DIST3D = 0.5f;
29
  static final float DIST2D = 0.5f;
30

  
31
  static final Static3D[] FACE_AXIS = new Static3D[]
32
         {
33
           new Static3D(1,0,0), new Static3D(-1,0,0),
34
           new Static3D(0,1,0), new Static3D(0,-1,0),
35
           new Static3D(0,0,1), new Static3D(0,0,-1)
36
         };
37

  
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 26

  
40 27
  MovementDino()
41 28
    {
42
    super(TwistyDino.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
29
    super(TwistyDino.ROT_AXIS);
43 30
    }
44 31

  
45 32
///////////////////////////////////////////////////////////////////////////////////////////////////
......
49 36
    return offset<DIST2D ? 0:2;
50 37
    }
51 38

  
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53

  
54
  public float returnRotationFactor(int numLayers, int row)
55
    {
56
    return 1.0f;
57
    }
58

  
59 39
///////////////////////////////////////////////////////////////////////////////////////////////////
60 40
// _____________
61 41
// |  \  0  /  |
......
74 54
    else      return p1 ? 1:2;
75 55
    }
76 56

  
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78

  
79
  boolean isInsideFace(int face, float[] p)
80
    {
81
    return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D );
82
    }
83

  
84 57
///////////////////////////////////////////////////////////////////////////////////////////////////
85 58

  
86 59
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)

Also available in: Unified diff