Rev 882 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 879 | chris | 1 | package com.gebauz.burutaru.game; |
| 2 | |||
| 3 | public class ShipParameters |
||
| 4 | { |
||
| 5 | |||
| 6 | |||
| 7 | // Constants======================================================================================== |
||
| 8 | |||
| 9 | public static final int MAX_SPEED_LEVEL = 5; |
||
| 10 | |||
| 11 | public static final float SPEED_FACTORS[] = |
||
| 12 | { |
||
| 882 | chris | 13 | 1.0f, |
| 879 | chris | 14 | 2.0f, |
| 882 | chris | 15 | 3.0f, |
| 879 | chris | 16 | 4.0f, |
| 882 | chris | 17 | 5.0f |
| 879 | chris | 18 | }; |
| 19 | |||
| 20 | // Embedded Types=================================================================================== |
||
| 21 | |||
| 22 | // Fields=========================================================================================== |
||
| 23 | |||
| 24 | private GameLogic mGameLogic = null; |
||
| 25 | private int mSpeedLevel = 1; |
||
| 891 | chris | 26 | |
| 27 | private boolean mMissilesEnabled = false; |
||
| 879 | chris | 28 | |
| 29 | // Methods========================================================================================== |
||
| 30 | |||
| 31 | public ShipParameters(GameLogic gameLogic) |
||
| 32 | { |
||
| 33 | mGameLogic = gameLogic; |
||
| 34 | } |
||
| 35 | |||
| 36 | public void upgradeSpeed() |
||
| 37 | { |
||
| 38 | if (mSpeedLevel < MAX_SPEED_LEVEL) |
||
| 39 | mSpeedLevel++; |
||
| 40 | } |
||
| 41 | |||
| 891 | chris | 42 | public void upgradeMissile() |
| 43 | { |
||
| 44 | mMissilesEnabled = true; |
||
| 45 | } |
||
| 46 | |||
| 879 | chris | 47 | public float modifySpeed(float move) |
| 48 | { |
||
| 49 | return move * SPEED_FACTORS[mSpeedLevel-1]; |
||
| 50 | } |
||
| 51 | |||
| 52 | // Getters/Setters================================================================================== |
||
| 53 | |||
| 54 | public int getSpeedLevel() { return mSpeedLevel; } |
||
| 891 | chris | 55 | public boolean areMissilesEnabled() { return mMissilesEnabled; } |
| 879 | chris | 56 | |
| 57 | |||
| 58 | |||
| 59 | } |