001    package components;
002    
003    import java.util.Map;
004    
005    import physics3d.Angle;
006    import physics3d.GameConstants;
007    import physics3d.Vect3;
008    
009    
010    /**
011     * <p>
012     * A RightFlipper extends Flipper, and flips in the left direction.
013     * </p>
014     * 
015     * <p>
016     * A RightFlipper has no unique properties that its parent does not have.  The only stipulation is that 
017     * it has a positive Z_HAT Orientation Vector, as opposed to the negative Z_HAT Orientation Vector found
018     * in a LeftFlipper.
019     *</p>
020     */
021    
022    public class RightFlipper extends Flipper {
023    
024            public RightFlipper(Map<String, String> props, GameSpace gs) {
025                    super(props, gs);
026                    //sore dake desu.
027            }
028    
029            @Override
030            public Vect3 getDiff() {
031                    double r = GameConstants.FLIPPER_RADIUS_FRACTION;
032                    int oa = (int)orientAngle.degrees();
033                    if (oa == 0) {
034                            return new Vect3(2-r, r, 0.5);
035                    } else if (oa == 90) {
036                            return new Vect3(2-r, 2-r, 0.5);
037                    } else if (oa == 180) {
038                            return new Vect3(r, 2-r, 0.5);
039                    } else if (oa == -90) {
040                            return new Vect3(r, r, 0.5);
041                    } else {
042                            throw new IllegalArgumentException("orientAngle must be 0, 90, 180, or 270 degrees, it is " + orientAngle.degrees());
043                    }
044            }
045    
046            
047            //See super class
048            public void getBasicPropertyMap(Map<String,String> m) {
049                    if (this.orientAngle.degrees() == -90) {
050                            m.put("orientation", "270");
051                    } else {
052                            m.put("orientation", Integer.toString((int)Math.round(this.orientAngle.degrees())));
053                    }
054                    super.getBasicPropertyMap(m);
055            }
056            
057            public GameObjectClassification getGOClassification() {
058                    return GameObjectClassification.RIGHTFLIPPER;
059            }
060    }