Пример #1
0
void ComponentAIBomber::update()
{
	GameObject::removeDeadOnesFromList(onVisionList);
	GameObject::removeDeadOnesFromList(defenders);

	if(!parent->isDead())
	{

		if( state == EnemyState::ATTACK && distanceFromThePath() > 60 )
		{

			watching = false;
			shooting = false;		
			target=NULL;
			selectedTarget = false;
			messageStopAIM();
			state = EnemyState::RETURN;
		}


		//Comprueba que pases cerca del punto final del camino y si cambia el camino
		if(parent->position.getDistanceFrom(path->getEnd()) < 30 && state != EnemyState::ATTACK)
		{
			messageStopAIM();
			changeTarget(true);
		}

		switch (state)
		{
		case ATTACK:
			updateAttack();
			break;
		case MOVE:
			updateMove();
			break;
		case RETURN:
			updateReturn();
			break;
		default:
			break;
		}
	} 
	else
	{
		std::list<GameObject*>::iterator it;
		for (it=defenders.begin(); it!=defenders.end(); ++it)
		{
			(*it)->kill();
		}
	}
}
Пример #2
0
	//--------------------------------------------------------------------------
	void AIController::update( Flt delta )
	{
		if(!mBaseAIGroup)
			return;

		if(mPauseThinkTime > 0)
		{
			mPauseThinkTime -= delta;
			return;
		}

		if(isDead())
		{
			return;
		}

		switch(mState)
		{
		case ACS_BIRTH:
			setPeaceState();
			break;

		case ACS_PEACE:
			break;

		case ACS_STARTFIGHT:
			break;

		case ACS_FIGHT:
			updateFightState(delta);
			break;

		case ACS_ENDFIGHT:
			break;

		case ACS_RETURN:
			updateReturn(delta);
			break;
		}
	}
Пример #3
0
Execut_window::Execut_window(QDialog *parent) :
    QDialog(parent),
    ui(new Ui::Execut_window)
{
    ui->setupUi(this);

    Execut_http_GAndP = new HttpGP;
    Show_Info = new ShowAllInfo;
    execute_V = new Execute_Variable;

    this->setWindowFlags(Qt::FramelessWindowHint);//去掉标题栏
//    move((QApplication::desktop()->width()-this->width())/2,(QApplication::desktop()->height()-this->height())/2);//居中

//    this->setWindowFlags(Qt::WindowStaysOnTopHint);//置顶
    QRegExp regx_bottleCapacity("[0-9]+$");//"[a-zA-Z0-9]+$" 长度7纯数字输入3.3格式
    QValidator *validator_bottleCapacity = new QRegExpValidator(regx_bottleCapacity,ui->lineEdit_changeVolume);
    ui->lineEdit_changeVolume->setValidator(validator_bottleCapacity);

    connect(Execut_http_GAndP,SIGNAL(sendInfo_To_executeOperate()),this,SLOT(updateReturn()));
    connect(Execut_http_GAndP,SIGNAL(sendFalse()),this,SLOT(NetworkError()));
    connect(Show_Info,SIGNAL(upStatus()),this,SIGNAL(upSheet_From_Execute()));//返回主界面

    execute_V->test=0;
}