Rev 891 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.burutaru.game;
public class ShipParameters
{
// Constants========================================================================================
public static final int MAX_SPEED_LEVEL = 5;
public static final float SPEED_FACTORS[] =
{
1.0f,
2.0f,
3.0f,
4.0f,
5.0f
};
// Embedded Types===================================================================================
public enum WeaponType
{
PLASMA_SHOT,
BEAM_SHOT,
SPREAD_SHOT,
NAPALM_SHOT,
}
// Fields===========================================================================================
private GameLogic mGameLogic = null;
private int mSpeedLevel = 1;
private boolean mMissilesEnabled = false;
private boolean mBombEnabled = false;
private WeaponType mWeaponType = WeaponType.PLASMA_SHOT;
// Methods==========================================================================================
public ShipParameters(GameLogic gameLogic)
{
mGameLogic = gameLogic;
}
public void upgradeSpeed()
{
if (mSpeedLevel < MAX_SPEED_LEVEL)
mSpeedLevel++;
}
public void upgradeMissile()
{
mMissilesEnabled = true;
}
public void upgradeBomb()
{
mBombEnabled = true;
}
public void activateBeamShot()
{
mWeaponType = WeaponType.BEAM_SHOT;
}
public float modifySpeed(float move)
{
return move * SPEED_FACTORS[mSpeedLevel-1];
}
// Getters/Setters==================================================================================
public int getSpeedLevel() { return mSpeedLevel; }
public boolean areMissilesEnabled() { return mMissilesEnabled; }
public boolean areBombsEnabled() { return mBombEnabled; }
public WeaponType getWeaponType() { return mWeaponType; }
}