本文整理汇总了C++中IAction::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ IAction::Initialize方法的具体用法?C++ IAction::Initialize怎么用?C++ IAction::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAction
的用法示例。
在下文中一共展示了IAction::Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NextStep
bool NextStep() {
if(actions_.Count() == 0) return false;
List<Point>* prevPoints = points_[points_.Count() - 1];
// Check if the next action should be executed.
if(currentStep_ == currentAction_->Steps()) {
// Skip over all connected actions.
size_t nextPosition = currentPosition_ + 1;
while(nextPosition < actions_.Count() && actions_[nextPosition]->WithPrevious()) {
nextPosition++;
}
size_t i = nextPosition + 1;
while((i < actions_.Count()) && actions_[i]->WithPrevious()) {
actions_[i]->Initialize(*prevPoints);
i++;
}
if(nextPosition < actions_.Count()) {
// Advance to the next action.
currentAction_ = actions_[nextPosition];
currentAction_->Initialize(*prevPoints);
currentPosition_ = nextPosition;
currentStep_ = 0;
}
else {
// All actions have been executed.
return false;
}
}
// Compute the next state of the shape.
// The generated points depend directly on the previous ones.
List<Point>* newPoints = new List<Point>(*prevPoints);
points_.Add(newPoints);
// Apply to the points the current action and all actions liked with it.
currentAction_->Execute(currentStep_, *newPoints);
for(size_t i = currentPosition_ + 1; i < actions_.Count(); i++) {
if(actions_[i]->WithPrevious()) {
actions_[i]->Execute(currentStep_, *newPoints);
}
else break;
}
currentStep_++;
return true;
}
示例2: Play
void Play() {
if(actions_.Count() == 0) return;
currentAction_ = actions_[0];
currentPosition_ = 0;
currentStep_ = 0;
List<Point> *firstPoints = new List<Point>(shape_->Points());
points_.Add(firstPoints);
// Initialize the start action and the ones connected to it.
currentAction_->Initialize(*firstPoints);
for(size_t i = 1; i < actions_.Count(); i++) {
if(actions_[i]->WithPrevious() == false) return;
actions_[i]->Initialize(*firstPoints);
}
}