示例#1
0
void EnemyShip::tick(irr::f32 deltaTime){
    Ship::tick(deltaTime);

    if(canMove){
		//Let the ship move
        move(moveSpeed, deltaTime);
		if(timeElapsed >= combatStartTime){
			//Perform the combat manouver
			combatManouver(deltaTime);
		}else{
			timeElapsed += deltaTime;
		}
    }

    //check the distance of the player
    if(!canMove && (getPosition().Z - playerTarget->getPosition().Z) <= activeDistance){
		canMove = true;
    }

    //check if the enemy is too far off to the left of the screen
    if(getPosition().Z + 15 < playerTarget->getPosition().Z){
        //don,t reward score if the ship goes off scren
        rewardScore = false;
        markForDelete();
    }
}
示例#2
0
	/** the full grids which apear twice will be deleted.
	 * The last instance will be deleted including the coefficient */
	void deleteDuplicate() {

		std::vector<bool> markForDelete(fullgrids_.size(), false);
		bool isEqual = false;

		// compare each grid to each grid and check if two are equal
		for (int i = 0; i < (int) fullgrids_.size(); i++) {
			for (int j = i + 1; j < (int) fullgrids_.size(); j++) {
				FullGrid<ELEMENT>* fg1 = fullgrids_[i];
				FullGrid<ELEMENT>* fg2 = fullgrids_[j];
				// test if full grid i is equal
				isEqual = true;
				for (int k = 0; k < dim_; k++) {
					isEqual = (isEqual
							&& (fg1->getLevels()[k] == fg2->getLevels()[k]));
				}
				markForDelete[j] = markForDelete[j] || isEqual;
			}
		}

		// delete the marked full grids
		for (int i = 0; i < (int) fullgrids_.size(); i++) {
			// if this grid was marked then
			if (markForDelete[i]) {
				deleteFullGrid(i);
			}
		}
	}
示例#3
0
void Projectile::deleteCountdown(unsigned int time)
{
	if (!isMoving)
	{
		deathCountdown +=  SDL_GetTicks() - deathCountdown;
		if (deathCountdown >= (deathStart + time))
		{
			markForDelete();
		}
	}
}
示例#4
0
void DActionsListView::action_markForDelete()
{
    //if(deleteAction->isChecked())
    if(deleteActionChecked)
    {
        deleteAction->setChecked(false);
        deleteActionChecked = false;
        emit unmarkForDelete(selectionModel()->selectedIndexes());
    }
    else
    {
        deleteAction->setChecked(true);
        deleteActionChecked = true;
        emit markForDelete(selectionModel()->selectedIndexes());
    }
}