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


C++ Character类代码示例

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


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

示例1: Division

int CharacterScriptInterface:: Division(lua_State * l_)
{
	Character* character = static_cast< Character* >( lua_touserdata( l_, 1 ) );
	float x= lua_tonumber(l_,2);
	float y= lua_tonumber(l_, 3);

	ValfirleToken::CreateData data;
	data.Position = LVector3(x,y,1.f);
	data.WeaponLevel = 1;
	data.WeaponType = WEAPON_VALFIRLE_TOKEN;
	ValfirleToken *pBoss = ValfirleToken::create(&data);
	pBoss->setDirection(character->getDirection());
	//pBoss->setVelocity(LVector3(5,4,1.f));
	pBoss->setInvincibleFrame(50);
	pBoss->setScore(1);
	pBoss->setLife(100);
	pBoss->setDefPosition(LVector3(x,y,1.f));
	
//	printf("分裂\n");
	return 0;
}
开发者ID:lriki,项目名称:Volkoff,代码行数:21,代码来源:CharacterScriptInterface.cpp

示例2: HR

void TriPickDemo::onResetDevice()
{
	HR(m_FX->OnResetDevice());
	HR(m_pCharacter->GetEffect()->OnResetDevice());
	//Aspect ratio rely on the size of back buffer 
	//Back buffer will change when user change window size, so we need to reset project matrix.
	float w = (float)md3dPP.BackBufferWidth;
	float h = (float)md3dPP.BackBufferHeight;

	g_Camera->setLens(D3DX_PI * 0.25f, w / h, 0.1f, 1000.0f);

}
开发者ID:duoshengyu,项目名称:InverseIK,代码行数:12,代码来源:MyApp.cpp

示例3: undoLastMove

void undoLastMove(Character & paladin, stack<std::shared_ptr<Memento>> & checkPoints)
{
	if (not checkPoints.empty())
	{
		paladin.restore(checkPoints.top() );
		checkPoints.pop();
	}
	else
	{
		cout << "No checkpoints to restore character state!" << endl;
	}
}
开发者ID:poorBob,项目名称:pro,代码行数:12,代码来源:main.cpp

示例4: spell_change_sex

void Character::spell_change_sex (int sn, int lvl, void *vo)
{
  Character *victim = (Character *) vo;
  Affect af;

  if (victim->has_affect(sn))
    return;
  af.type = sn;
  af.duration = 10 * lvl;
  af.location = APPLY_SEX;
  do {
    af.modifier = number_range (0, 2) - victim->sex;
  }
  while (af.modifier == 0);
  af.bitvector = 0;
  victim->affect_to_char(&af);
  victim->send_to_char ("You feel different.\r\n");
  if (this != victim)
    send_to_char ("Ok.\r\n");
  return;
}
开发者ID:MUDOmnibus,项目名称:Merc22-for-Cpp,代码行数:21,代码来源:spells.cpp

示例5: main

int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    
    using RBSpace::Character;
    Character *ch = new Character;
    ch->getStr();
    ch->getStr2();
    
    delete ch;
    ch = NULL;

    DLog("test:%s", "zruibin\n");
    
    testASM001();

    // RBSpace::testHttpClient(); //测试curl
    RBSpace::threadTest(); //测试多线程

    return 0;
}
开发者ID:zruibin,项目名称:PimplCPP,代码行数:21,代码来源:main.cpp

示例6: spell_colour_spray

void Character::spell_colour_spray (int sn, int lvl, void *vo)
{
  Character *victim = (Character *) vo;
  static const sh_int dam_each[] = {
    0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    30, 35, 40, 45, 50, 55, 55, 55, 56, 57,
    58, 58, 59, 60, 61, 61, 62, 63, 64, 64,
    65, 66, 67, 67, 68, 69, 70, 70, 71, 72,
    73, 73, 74, 75, 76, 76, 77, 78, 79, 79
  };

  lvl = std::min (lvl, (int) (sizeof (dam_each) / sizeof (dam_each[0]) - 1));
  lvl = std::max (0, lvl);
  int dam = number_range (dam_each[lvl] / 2, dam_each[lvl] * 2);
  if (victim->saves_spell (lvl))
    dam /= 2;

  damage (this, victim, dam, sn);
  return;
}
开发者ID:MUDOmnibus,项目名称:Merc22-for-Cpp,代码行数:21,代码来源:spells.cpp

示例7: deactivate

void TaskWaitForAction::run(double deltaTime)
{
	// Glotz Ghost reacts if its in fov

	//Wenn er gesehen wird, geht er auf den Character los
	if( fov->isCharacterSeen(character) )
	{
		deactivate();
		parent->childTerminated(this,true);
		return;
	}

	//Prüft ob der Spieler nah genug dran ist um Leben zu verlieren
	Character *player = CharacterManager::instance()->getCharacter("Player");
	if((character->getPosition() - player->getPosition()).getLength() <= GHOST_PLAYER_DIST)
	{
		// Player dies
		PlayerMoveComponent *movComp = getComponent<PlayerMoveComponent>(player);
		movComp->loseHealth(5);
	}
}
开发者ID:Goriar,项目名称:Ai-Project,代码行数:21,代码来源:TaskWaitForAction.cpp

示例8: lua_gettop

int script::offerSkills(lua_State *L)
{
	const int n = lua_gettop(L);
	if (n < 4)
		return 0;
	Character *c = (Character *)lua_touserdata(L, 1);
	Entity *e = (Entity *)lua_touserdata(L, 2);
	size_t sz;
	const char *text = lua_tolstring(L, 3, &sz);
	bool spells = lua_toboolean(L, 4);

	std::vector<SkillInfo *> skills;
	for (int i = 5; i <= n; i++) {
		SkillInfo *si = SkillInfo::getById((unsigned)lua_tonumber(L, i));
		if (si)
			skills.push_back(si);
	}

	Server::sendSkillList(c->getSession(), e, sz, text, skills, spells);
	return 0;
}
开发者ID:renaissance-da,项目名称:server,代码行数:21,代码来源:npc_bindings.cpp

示例9: getCurrentCharByName

bool ChatHandler::HandleAppearCommand(uint8* args)
{
    wowWData data;

    if(!*args)
        return false;

	Character *pChar = getCurrentCharByName(args);
	if (pChar)
	{
		uint16 c=pChar->getMapId();
		float x=pChar->getPositionX();
		float y=pChar->getPositionY();
		float z=pChar->getPositionZ();
		Message(pChar,"appear to");

		smsg_NewWorld(m_pClient, c,x,y,z);
	}

    return true;
}
开发者ID:AwkwardDev,项目名称:WoWPython,代码行数:21,代码来源:Level1.cpp

示例10: init

	// Initializeaza primele personaje, variabilele pentru cutremur si camerele.
	void init() {
		if (!special_mode) {
			main_character = new Character(MAIN_ACTIVE, main_slope, obj_build, quad);
			second_character = new Character(SECOND_ACTIVE, second_slope, obj_build, quad);
		}
		else {
			main_character = new Character(MAIN_SPECIAL, main_slope, obj_build, quad);
			second_character = new Character(SECOND_SPECIAL, second_slope, obj_build, quad);
		}
		characters.push_back(main_character);
		characters.push_back(second_character);

		x_quake = -1;
		amplitude = 0;
		frequency = 0;
		srand(time(NULL));
		stop = false;

		cam_index = 0;
		cams.push_back(new lab::Camera());
		cams.push_back(new lab::Camera());
		cams.push_back(new lab::Camera());
		cams.push_back(new lab::Camera());
		cams.push_back(new lab::Camera());
		cams.push_back(new lab::Camera());
		cams.push_back(new lab::Camera());
		cams[1]->set(glm::vec3(10, 1, quad->getSize() - 10), glm::vec3(43, 30, 30), glm::vec3(0, 1, 0));
		cams[3]->set(glm::vec3(quad->getSize() - 10, 1, quad->getSize() - 10), glm::vec3(56, 40, 30), glm::vec3(0, 1, 0));
		cams[6]->set(glm::vec3(50, 100, 50), glm::vec3(49, 0, 49), glm::vec3(0, 100, 50));
		cams[6]->rotateFPSoX(-1.0f);

		delete cams[0];
		delete cams[2];
		delete cams[4];
		delete cams[5];
		cams[0] = main_character->getFpsCam();
		cams[2] = second_character->getFpsCam();
		cams[4] = main_character->getTpsCam();
		cams[5] = second_character->getTpsCam();
	}
开发者ID:DianaDespa,项目名称:Ski-Jumping,代码行数:41,代码来源:main.cpp

示例11: impact

bool KeyboardCharacterMover::impact(Character &character)
{
// Store character velocity
    m_characterVelocityY = character.m_velocityY;

//Check rebound in y axis
    if(m_physic.checkRebound(character.m_velocityY))
    {
        ServiceLocator::GetAudio()->playSound("impact.ogg", 100, false);
        character.m_damagesFilter.setAlpha(100);
        character.m_damagesFilter.setActive(true);

        if(m_characterVelocityY <= 700)
            character.getLife().removeLife(m_characterVelocityY * 1/30 * (100 - character.getProperty(Property::Protection)) / 100);

        if(m_characterVelocityY > 700 && m_characterVelocityY <= 1000)
            character.getLife().removeLife(m_characterVelocityY * 1/20 * (100 - character.getProperty(Property::Protection)) / 100);

        if(m_characterVelocityY > 1000)
            character.getLife().removeLife(m_characterVelocityY * 1/12 * (100 - character.getProperty(Property::Protection)) / 100);

        return true;
    }

//If there's no rebound
    else if(m_characterVelocityY > 0)
    {
        m_flying = false;
        character.m_velocityY = 0;
        return false;
    }

    return false;
}
开发者ID:Sytten,项目名称:MineDeeper,代码行数:34,代码来源:KeyboardCharacterMover.cpp

示例12: handleGivePermission

static void handleGivePermission(Character *player, std::string &args)
{
    Character *other;

    // get the arguments
    std::string character = getArgument(args);
    std::string strPermission = getArgument(args);

    // check all arguments are there
    if (character.empty() || strPermission.empty())
    {
        say("Invalid number of arguments given.", player);
        say("Usage: @givepermission <character> <permission class>", player);
        return;
    }

    // check if its to effect the player
    if (character == "#")
    {
        other = player;
    }
    else
    {
        // check for valid player
        other = gameHandler->getCharacterByNameSlow(character);
        if (!other)
        {
            say("Invalid character", player);
            return;
        }
    }

    unsigned char permission = PermissionManager::getMaskFromAlias(strPermission);

    if (permission == 0x00)
    {
        say ("Unknown permission class: "+strPermission, player);
        return;
    }

    if (permission & other->getAccountLevel())
    {
        say(player->getName()+" already has the permission "+strPermission, player);
    }
    else
    {
        permission += other->getAccountLevel();
        // change the player's account level
        other->setAccountLevel(permission);
        accountHandler->changeAccountLevel(other, permission);

        // log transaction
        std::string msg = "User gave right " + strPermission + " to " + other->getName();
        accountHandler->sendTransaction(player->getDatabaseID(), TRANS_CMD_SETGROUP, msg);
        say("You gave " + other->getName() +
            " the rights of a " + strPermission, player);
        say("Congratulations, " + player->getName() +
            " gave you the rights of a " + strPermission, other);
    }
}
开发者ID:cubemoon,项目名称:manaserv,代码行数:60,代码来源:commandhandler.cpp

示例13: handleTakeSpecial

static void handleTakeSpecial(Character *player, std::string &args)
{
    std::string character = getArgument(args);
    std::string special = getArgument(args);
    if (character.empty() || special.empty())
    {
        say("Invalid amount of arguments given.", player);
        say("Usage: @takespecial <character> <special>", player);
        return;
    }

    Character *other;
    if (character == "#")
        other = player;
    else
        other = gameHandler->getCharacterByNameSlow(character);

    if (!other)
    {
        say("Invalid character, or player is offline.", player);
        return;
    }

    int specialId;
    if (utils::isNumeric(special))
        specialId = utils::stringToInt(special);
    else
        specialId = specialManager->getId(special);

    if (specialId <= 0)
    {
        say("Invalid special.", player);
        return;
    }
    if (!other->takeSpecial(specialId))
    {
        say("Character does not have special.", player);
        return;
    }
}
开发者ID:cubemoon,项目名称:manaserv,代码行数:40,代码来源:commandhandler.cpp

示例14: CanUseSkill

bool CanUseSkill(Client* client)
{
	Character* chr = client->chr;

	if ( chr->dead() )
	{
		private_say_above(chr, chr, "I am dead and cannot do that.");
		return false;
	}
	else if ( chr->skill_ex_active() || chr->casting_spell() )
	{
		private_say_above(chr, chr,"I am already performing another action.");
		return false;
	}
	else if ( poltime() < chr->disable_skills_until )
	{
		send_sysmessage(client, "You must wait to perform another action.");
		return false;
	}
	else if ( chr->frozen() || chr->paralyzed() )
	{
		private_say_above(chr, chr, "I am frozen and cannot do that.");
		return false;
	}

	return true;
}
开发者ID:alucardxlx,项目名称:polserver-zulu,代码行数:27,代码来源:useskill.cpp

示例15: isInFOV

bool CoordinateUtil::isInFOV(Character &source, Character &target, Direction direction,
                             float fovAngleR, float fovDistance)
{
    // Get the Sprite positions
    Vector2f sourceCenter(source.getSize().x / 2, source.getSize().y / 2);
    Vector2f targetCenter(target.getSize().x / 2, target.getSize().y / 2);


    // Transform the target position into the source's coordinate space
    //cout << "-----" << endl;
    //cout << PRINT_V(targetCenter) << endl;
    targetCenter = target.getSprite()->toGlobal(targetCenter);
    //cout << PRINT_V(targetCenter) << endl;
    targetCenter = source.getSprite()->toLocal(targetCenter);

    // Perform the FOV check
    bool insideFOV = false;
    float distance = getDistance(sourceCenter, targetCenter);
    // TODO multiply distance my scale of source
    //cout << PRINT_V(sourceCenter) << " -> " << PRINT_V(targetCenter) << " = ";
    //cout << distance << endl;
    if(distance <= fovDistance)
    {
        // Check the angle between the source and the target
        float angleR = atan2(targetCenter.y - sourceCenter.y, targetCenter.x - sourceCenter.x);

        // TODO: Only works if source if facing left
        if(direction == Left)
            angleR += M_PI;
        if(angleR <= fovAngleR || angleR >= M_PI_2 - fovAngleR)
            insideFOV = true;
    }

    return insideFOV;
}
开发者ID:FahmiA,项目名称:Flat-World,代码行数:35,代码来源:CoordinateUtil.cpp


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