public static void act(Unit unit) {

		// NOT cloaked.
		if (!unit.isCloaked()) {
			if (unit.getEnergy() > 10 && TechnologyManager.isWraithCloakingFieldResearched()) {
				unit.cloak();
				UnitActions.useTech(unit, TechnologyManager.CLOAKING_FIELD);
			}
		}

		// CLOAKED.
		else {
			double nearestEnemyDist = xvr.getNearestEnemyDistance(unit, true, true);
			boolean isEnemyNear = nearestEnemyDist < -0.1 && nearestEnemyDist > 11;
			boolean isDetectedByEnemy = unit.isDetected();
			if (isEnemyNear || isDetectedByEnemy) {
				unit.decloak();
			}
		}
	}