* Method powerOff.
* @param powerUnit PowerControlUnitInstance
*/
public void powerOff(PowerControlUnitInstance powerUnit)
{
FortressSiegeEvent event = getEvent(FortressSiegeEvent.class);
SpawnExObject exObject = event.getFirstObject(FortressSiegeEvent.IN_POWER_UNITS);
int machineNumber = -1;
for (int i = 0; i < 3; i++)
{
Spawner spawn = exObject.getSpawns().get(i);
if (spawn == powerUnit.getSpawn())
{
machineNumber = i;
}
}
NpcString msg = null;
switch (machineNumber)
{
case 0:
msg = NpcString.MACHINE_NO_1_POWER_OFF;
break;
case 1:
msg = NpcString.MACHINE_NO_2_POWER_OFF;
break;
case 2:
msg = NpcString.MACHINE_NO_3_POWER_OFF;
break;
default:
throw new IllegalArgumentException("Wrong spawn at fortress: " + event.getName());
}
_powerUnits--;
Functions.npcShout(this, msg);
}