当前位置: 首页>>代码示例>>C++>>正文


C++ MetaType::getTechType方法代码示例

本文整理汇总了C++中MetaType::getTechType方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaType::getTechType方法的具体用法?C++ MetaType::getTechType怎么用?C++ MetaType::getTechType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MetaType的用法示例。


在下文中一共展示了MetaType::getTechType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: canMakeNow

bool ProductionManager::canMakeNow(BWAPI::Unit producer, MetaType t)
{
    //UAB_ASSERT(producer != nullptr, "Producer was null");

	bool canMake = meetsReservedResources(t);
	if (canMake)
	{
		if (t.isUnit())
		{
			canMake = BWAPI::Broodwar->canMake(t.getUnitType(), producer);
		}
		else if (t.isTech())
		{
			canMake = BWAPI::Broodwar->canResearch(t.getTechType(), producer);
		}
		else if (t.isUpgrade())
		{
			canMake = BWAPI::Broodwar->canUpgrade(t.getUpgradeType(), producer);
		}
		else
		{	
			UAB_ASSERT(false, "Unknown type");
		}
	}

	return canMake;
}
开发者ID:pineal,项目名称:SC_AI_Flash,代码行数:27,代码来源:ProductionManager.cpp

示例2: create

// this function will check to see if all preconditions are met and then create a unit
void ProductionManager::create(BWAPI::Unit producer, BuildOrderItem & item) 
{
    if (!producer)
    {
        return;
    }

    MetaType t = item.metaType;

    // if we're dealing with a building
    if (t.isUnit() && t.getUnitType().isBuilding() 
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Lair 
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Hive
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Greater_Spire
        && !t.getUnitType().isAddon())
    {
        // send the building task to the building manager
		if (t.getUnitType() == BWAPI::UnitTypes::Terran_Bunker)
		{
			BWAPI::TilePosition tp = BWAPI::TilePosition(BWTA::getNearestChokepoint(BWAPI::Position(BWAPI::Broodwar->self()->getStartLocation()))->getCenter());
			BuildingManager::Instance().addBuildingTask(t.getUnitType(), tp, item.isGasSteal);
		}
		else {
			BuildingManager::Instance().addBuildingTask(t.getUnitType(), BWAPI::Broodwar->self()->getStartLocation(), item.isGasSteal);
		}
    }
    else if (t.getUnitType().isAddon())
    {
        //BWAPI::TilePosition addonPosition(producer->getTilePosition().x + producer->getType().tileWidth(), producer->getTilePosition().y + producer->getType().tileHeight() - t.unitType.tileHeight());
        producer->buildAddon(t.getUnitType());
    }
    // if we're dealing with a non-building unit
    else if (t.isUnit()) 
    {
        // if the race is zerg, morph the unit
        if (t.getUnitType().getRace() == BWAPI::Races::Zerg) 
        {
            producer->morph(t.getUnitType());
        // if not, train the unit
        } 
        else 
        {
            producer->train(t.getUnitType());
        }
    }
    // if we're dealing with a tech research
    else if (t.isTech())
    {
        producer->research(t.getTechType());
    }
    else if (t.isUpgrade())
    {
        //Logger::Instance().log("Produce Upgrade: " + t.getName() + "\n");
        producer->upgrade(t.getUpgradeType());
    }
    else
    {	
		
    }
}
开发者ID:smithe0,项目名称:ualbertabot,代码行数:61,代码来源:ProductionManager.cpp

示例3: canMakeNow

bool ProductionManager::canMakeNow(BWAPI::Unit producer, MetaType t)
{
    //UAB_ASSERT(producer != nullptr, "Producer was null");

	bool canMake = meetsReservedResources(t);
	if (canMake)
	{
		if (t.isUnit())
		{
			canMake = BWAPI::Broodwar->canMake(t.getUnitType(), producer);
		}
		else if (t.isTech())
		{
			canMake = BWAPI::Broodwar->canResearch(t.getTechType(), producer);
		}
		else if (t.isUpgrade())
		{
			if (t.getUpgradeType() == BWAPI::UpgradeTypes::Zerg_Carapace)
			{
				BWAPI::Broodwar->printf("Trying to create carapace with %d %d EVO CHAMBER\n", producer->getTilePosition().x, producer->getTilePosition().y);
			}
			else if ((t.getUpgradeType() == BWAPI::UpgradeTypes::Zerg_Missile_Attacks))
			{
				BWAPI::Broodwar->printf("Trying to create misisle attacks with %d %d EVO CHAMBER\n", producer->getTilePosition().x, producer->getTilePosition().y);
			}
			canMake = BWAPI::Broodwar->canUpgrade(t.getUpgradeType(), producer);
		}
		else
		{	
			UAB_ASSERT(false, "Unknown type");
		}
	}

	return canMake;
}
开发者ID:0x4849,项目名称:c350,代码行数:35,代码来源:ProductionManagerbuggy.cpp

示例4: GetActionType

BOSS::ActionType BOSSManager::GetActionType(const MetaType & t)
{
    // set the appropriate type
    if (t.isUnit())
    {
        return BOSS::ActionType(t.getUnitType());
    }
    else if (t.isUpgrade())
    {
        return BOSS::ActionType(t.getUpgradeType());
    }
    else if (t.isTech())
    {
        return BOSS::ActionType(t.getTechType());
    }
    else
    {
        UAB_ASSERT(false, "Should have found a valid type here");
    }

    return BOSS::ActionType();
}
开发者ID:ssssuishui,项目名称:ualbertabot,代码行数:22,代码来源:BOSSManager.cpp

示例5: create

// this function will check to see if all preconditions are met and then create a unit
void ProductionManager::create(BWAPI::Unit producer, BuildOrderItem & item)
{
	if (!producer)
	{
		return;
	}

	MetaType t = item.metaType;

	// if we're dealing with a building
	if (t.isUnit() && t.getUnitType().isBuilding()
		&& t.getUnitType() != BWAPI::UnitTypes::Zerg_Lair
		&& t.getUnitType() != BWAPI::UnitTypes::Zerg_Hive
		&& t.getUnitType() != BWAPI::UnitTypes::Zerg_Greater_Spire
		&& t.getUnitType() != BWAPI::UnitTypes::Zerg_Sunken_Colony
		&& !t.getUnitType().isAddon())
	{
		// send the building task to the building manager
		BuildingManager::Instance().addBuildingTask(t.getUnitType(), BWAPI::Broodwar->self()->getStartLocation(), item.isGasSteal);
	}
	else if (t.getUnitType().isAddon())
	{
		//BWAPI::TilePosition addonPosition(producer->getTilePosition().x + producer->getType().tileWidth(), producer->getTilePosition().y + producer->getType().tileHeight() - t.unitType.tileHeight());
		producer->buildAddon(t.getUnitType());
	}
	// if we're dealing with a non-building unit
	else if (t.isUnit())
	{
		// if the race is zerg, morph the unit
		if (t.getUnitType().getRace() == BWAPI::Races::Zerg)
		{
			producer->morph(t.getUnitType());
			if (t.getUnitType() == BWAPI::UnitTypes::Zerg_Overlord)
			{
				_overlordTimer = BWAPI::Broodwar->getFrameCount() + t.getUnitType().buildTime() + 35;
			}

			// if not, train the unit
		}
		else
		{
			producer->train(t.getUnitType());
		}
	}
	// if we're dealing with a tech research
	else if (t.isTech())
	{
		producer->research(t.getTechType());
	}
	else if (t.isUpgrade())
	{
		//Logger::Instance().log("Produce Upgrade: " + t.getName() + "\n");
		
		if (t.getUpgradeType() == BWAPI::UpgradeTypes::Muscular_Augments)
		{
			muscBuildTimer = BWAPI::Broodwar->getFrameCount() + t.getUpgradeType().upgradeTime();
			muscBuild = true;
		}
		producer->upgrade(t.getUpgradeType());
	}
	else
	{

	}
}
开发者ID:0x4849,项目名称:c350,代码行数:66,代码来源:ProductionManager.cpp

示例6: create

// this function will check to see if all preconditions are met and then create a unit
void ProductionManager::create(BWAPI::Unit producer, BuildOrderItem & item) 
{
    if (!producer)
    {
        return;
    }

    MetaType t = item.metaType;

    // if we're dealing with a building
    if (t.isUnit() && t.getUnitType().isBuilding() 
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Lair 
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Hive
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Greater_Spire
		&& t.getUnitType() != BWAPI::UnitTypes::Zerg_Sunken_Colony
        && !t.getUnitType().isAddon())
    {
        // send the building task to the building manager
        BuildingManager::Instance().addBuildingTask(t.getUnitType(), BWAPI::Broodwar->self()->getStartLocation(), item.isGasSteal);
    }
    else if (t.getUnitType().isAddon())
    {
        //BWAPI::TilePosition addonPosition(producer->getTilePosition().x + producer->getType().tileWidth(), producer->getTilePosition().y + producer->getType().tileHeight() - t.unitType.tileHeight());
        producer->buildAddon(t.getUnitType());
    }
    // if we're dealing with a non-building unit
    else if (t.isUnit()) 
    {
        // if the race is zerg, morph the unit
        if (t.getUnitType().getRace() == BWAPI::Races::Zerg) 
        {
			if (t.getUnitType() == BWAPI::UnitTypes::Zerg_Overlord)
			{
				overlordBuildTimer = BWAPI::Broodwar->getFrameCount() + t.getUnitType().buildTime();
				canOverlord = true;
			}
            producer->morph(t.getUnitType());
        // if not, train the unit
        } 
        else 
        {
            producer->train(t.getUnitType());
        }
    }
    // if we're dealing with a tech research
    else if (t.isTech())
    {
        producer->research(t.getTechType());
    }
    else if (t.isUpgrade())
    {
		if (t.getUpgradeType() == BWAPI::UpgradeTypes::Zerg_Carapace)
		{
			BWAPI::Broodwar->printf("Got a request for carapace upgrade using producer x %d y %d: \n", producer->getTilePosition().x, producer->getTilePosition().y);
		}
		else if (t.getUpgradeType() == BWAPI::UpgradeTypes::Zerg_Missile_Attacks)
		{
			BWAPI::Broodwar->printf("Got a request for missile attacks upgrade using producer x %d y %d : \n", producer->getTilePosition().x, producer->getTilePosition().y);
		}
		producer = getEvolutionChamberProducer(producer, t);
		//BWAPI::Broodwar->printf("Got request for capace or missile attacks with producer type : x : %d  y: %d\n", producer->getTilePosition().x, producer->getTilePosition().y);
		//}
        //Logger::Instance().log("Produce Upgrade: " + t.getName() + "\n");
        producer->upgrade(t.getUpgradeType());
		upgradingStuff.insert(producer);
    }
    else
    {	
		
    }
}
开发者ID:0x4849,项目名称:c350,代码行数:72,代码来源:ProductionManagerbuggy.cpp


注:本文中的MetaType::getTechType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。