本文整理汇总了C++中CreatureObject::setMentalStateTowardClampBehavior方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::setMentalStateTowardClampBehavior方法的具体用法?C++ CreatureObject::setMentalStateTowardClampBehavior怎么用?C++ CreatureObject::setMentalStateTowardClampBehavior使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureObject
的用法示例。
在下文中一共展示了CreatureObject::setMentalStateTowardClampBehavior方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addToMentalStateTowardClampBehavior
/**
* Adds a value to a creature's mental state.
*
* @param env Java environment
* @param self class calling this function
* @param mob id of creature to access
* @param mentalState mental state we are interested in
* @param value value to add to the mental state
*
* @return true on success, false on fail
*/
jboolean JNICALL ScriptMethodsMentalStatesNamespace::addToMentalStateTowardClampBehavior(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState, jfloat value, jint behavior)
{
UNREF(self);
if (target == 0 || mentalState < 0 || mentalState >= MentalStates::NumberOfMentalStates)
return JNI_FALSE;
CreatureObject * creature = 0;
if (!JavaLibrary::getObject(mob, creature))
return JNI_FALSE;
NetworkId targetId(target);
if (!targetId)
return JNI_FALSE;
MentalStates::Value current = creature->getMentalStateToward(targetId, static_cast<MentalStates::Enumerator>(mentalState));
LOGC(ConfigServerGame::isAiLoggingEnabled(), "debug_ai", ("ScriptMethodsMentalStates::addToMentalStateTowardClampBehavior() %s->%s state(%s) value(%.0f+%.0f) behavior(%s)", creature->getNetworkId().getValueString().c_str(), targetId.getValueString().c_str(), CreatureObject::getMentalStateString(mentalState), current, value, CreatureObject::getBehaviorString(behavior)));
creature->setMentalStateTowardClampBehavior(targetId,
static_cast<MentalStates::Enumerator>(mentalState),
static_cast<MentalStates::Value>(current + value),
static_cast<Behaviors::Enumerator>(behavior));
return JNI_TRUE;
} // JavaLibrary::addToMentalState
示例2: setMentalStateTowardClampBehavior
/**
* Sets a creatue's mental state.
*
* @param env Java environment
* @param self class calling this function
* @param target id of creature to access
* @param mentalState mental state we are interested in
* @param value value to set the mental state to
*
* @return true on success, false on fail
*/
jboolean JNICALL ScriptMethodsMentalStatesNamespace::setMentalStateTowardClampBehavior(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState, jfloat value, jint behavior)
{
UNREF(self);
if (target == 0 || mentalState < 0 || mentalState >= MentalStates::NumberOfMentalStates)
return JNI_FALSE;
CreatureObject * creature = 0;
if (!JavaLibrary::getObject(mob, creature))
return JNI_FALSE;
NetworkId targetId(target);
if (!targetId)
return JNI_FALSE;
creature->setMentalStateTowardClampBehavior(targetId,
static_cast<MentalStates::Enumerator>(mentalState),
static_cast<MentalStates::Value>(value),
static_cast<Behaviors::Enumerator>(behavior));
return JNI_TRUE;
} // JavaLibrary::setAttrib