本文整理汇总了C++中Actor::AddAction方法的典型用法代码示例。如果您正苦于以下问题:C++ Actor::AddAction方法的具体用法?C++ Actor::AddAction怎么用?C++ Actor::AddAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actor
的用法示例。
在下文中一共展示了Actor::AddAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindObject
bool
Script::_ExecuteAction(action_node* act)
{
#if DEBUG_SCRIPTS
printf("SCRIPT: %s (%d 0x%x)\n", IDTable::ActionAt(act->id).c_str(), act->id, act->id);
act->Print();
#endif
Core* core = Core::Get();
Actor* thisActor = dynamic_cast<Actor*>(fTarget.Target());
switch (act->id) {
case 0x03:
{
/* Attack(O:Target*) */
Object* targetObject = FindObject(act);
if (targetObject != NULL) {
Actor* targetActor = dynamic_cast<Actor*>(targetObject);
if (thisActor != NULL && targetActor != NULL) {
Attack* attackAction = new Attack(thisActor, targetActor);
thisActor->AddAction(attackAction);
}
}
break;
}
case 0x07:
{
/* CreateCreature(S:NewObject*,P:Location*,I:Face*) */
// TODO: If point is (-1, -1) we should put the actor near
// the active creature. Which one is the active creature?
IE::point point = act->where;
if (point.x == -1 && point.y == -1) {
point = Game::Get()->Party()->ActorAt(0)->Position();
point.x += Core::RandomNumber(-20, 20);
point.y += Core::RandomNumber(-20, 20);
}
Actor* actor = new Actor(act->string1, point, act->integer1);
RoomContainer::Get()->ActorEnteredArea(actor);
// TODO: Add actor to the current area
break;
}
case 0x8:
{
/* DIALOGUE(O:OBJECT*) (8 0x8) */
Actor* actor = dynamic_cast<Actor*>(FindObject(act));
if (actor != NULL) {
Dialogue* dialogueAction = new Dialogue(thisActor, actor);
thisActor->AddAction(dialogueAction);
}
break;
}
case 0xA:
{
/* ENEMY() (10 0xa) */
uint32 id = IDTable::EnemyAllyValue("ENEM");
thisActor->SetEnemyAlly(id);
break;
}
case 22:
{
// MoveToObject
Object* object = FindObject(act);
if (object != NULL) {
WalkTo* walkTo = new WalkTo(thisActor, object->Position());
fTarget.Target()->AddAction(walkTo);
}
break;
}
case 23:
{
// MoveToPoint
Actor* actor = dynamic_cast<Actor*>(fTarget.Target());
if (actor != NULL) {
WalkTo* walkTo = new WalkTo(actor, act->where);
actor->AddAction(walkTo);
actor->StopCheckingConditions();
}
break;
}
case 29:
{
/* RunAwayFrom(O:Creature*,I:Time*) */
Actor* targetActor = dynamic_cast<Actor*>(FindObject(act));
if (targetActor != NULL && thisActor != NULL) {
RunAwayFrom* run = new RunAwayFrom(thisActor, targetActor);
fTarget.Target()->AddAction(run);
}
break;
}
case 36:
{
/*
* 36 Continue()
* This action instructs the script parser to continue looking
* for actions in the active creatures action list.
* This is mainly included in scripts for efficiency.
* Continue should also be appended to any script blocks added
//.........这里部分代码省略.........