Exemple #1
0
 void Nature::setCurrentTree(Tree *tree) {
     _currentTree = tree;
     
     // Set stretching bounds
     ichigo::StretchingState *stretchingState = (ichigo::StretchingState *)getFSM()->getState("Default");
     ichigo::Rect clipBounds = _currentTree->getTileMap()->getBoundingBox();
     stretchingState->setLimitsForBounds(clipBounds.minX, clipBounds.minY, clipBounds.maxX, clipBounds.maxY);
 }
 FunctionalUnitTest::MyStateInterface*
 FunctionalUnitTest::WaitingForACKReconfiguration::doOnData(const CompoundPtr&)
 {
     // if this is called we assume this is the ack and throw it away
     // we need to wakeup the other FUs
     getFU()->wakeup();
     return getFSM()->createState<ReadyForTransmissionReconfiguration>();
 }
void SpiritFreezeSkillWeapon::onAttackEffect( string evt )
{
    if (!isTargetAlive())
    {
        return;
    }

    /**
    *	 @_@ 发起攻击,其实就是让敌人进入冻结状态,显示这一块暂时也放在
    *   状态里面,以后可能还是使用消息的方式,但是目前图简单,先直接修改
    *   目标的状态
    */
    auto tmpTarget  =   
        dynamic_cast<GameCharacter*>(EntityMgr->getEntityFromID(m_targetId));
    tmpTarget->getFSM()->changeState(GameCharacterFrozenState::create());

    // @_@ 应该还会造成伤害,这里暂时留着不写
}
 /**
  * @brief Returns a reference to the VARIABLES of the FSM
  *
  * @note: This function is provided for convenience only.
  */
 VariablesType&
 vars()
 {
     return getFSM()->getVariables();
 }
 FunctionalUnitTest::MyStateInterface*
 FunctionalUnitTest::ReadyForTransmission::doSendData(const CompoundPtr& compound)
 {
     getFU()->getConnector()->getAcceptor(compound)->sendData(compound);
     return getFSM()->createState<WaitingForACK>();
 }