Exemplo n.º 1
0
void AutoShooter::update() {
    switch(cur_state)
    {
        case OFF:
            break;
        case VISION:
            setCurrentTarget();
            cur_state = SETTING;
            break;
        case SETTING:
            doSetting();
            cur_state = WAITING;
            break;
        case WAITING:
            if(angleAdjuster.at_angle() && drive_train.isFinished())
            {
                if(isAimed())
                {
                    cur_state = SHOOTING;
                }
            }   
            break;
        case SHOOTING:
            doShooting();
            break;
    }
}
Exemplo n.º 2
0
void UnitFiring::autoFire() {
	mTargetAquired = selectTarget();
	if (!mTargetAquired) mAimReset = true;

	if (mTargetAquired) {
		mTargetPosition = predictTargetPosition( const_cast<Unit*>(mTargetUnit));
		aim();
		if (isAimed()) {
			fire();
		}
	} else if (mAimReset) {
		resetAim();
	} else {
		freezeAim();
	}

	theApp->displayUnitReload(this, getRemainingReloadTime());
}