Ejemplo n.º 1
0
 mailsType::mailsType(AnyTypeCreateArgs args):
 XMLSchema::Types::anyType(AnyTypeCreateArgs(false, 
                                             args.ownerNode, 
                                             args.ownerElem, 
                                             args.ownerDoc, 
                                             args.childBuildsTree, 
                                             (args.createFromElementAttr? false : args.abstract),
                                             args.blockMask,
                                             args.finalMask,
                                             args.contentTypeVariety,
                                             args.anyTypeUseCase,
                                             args.suppressTypeAbstract
                                            )),
   
   _fsmElems(NULL),
   _fsmAttrs(NULL)
 
   , _sequenceList(new sequenceList(this) )
 
 {
   this->contentTypeVariety(CONTENT_TYPE_VARIETY_ELEMENT_ONLY);
   initFSM();
   if(args.ownerDoc && args.ownerDoc->buildTree() && !args.childBuildsTree)
   {
     if(args.ownerDoc->createSample()) {
       _fsm->fireSampleEvents();
     }
     else {
       _fsm->fireRequiredEvents();
     }
   }
 }
Ejemplo n.º 2
0
bool BaseCar::init(std::string fileName , float originVelo, cocos2d::Vec2 originPos , int direction)
{
    this->initWithFile(fileName);
    _normalRes = fileName;
    _originAngle = getRotation3D().z;
    _direction = direction;
    _originVelo = originVelo;
    _originPos = originPos;
    setVelo(originVelo , true);
    setPosition(originPos);
    initFSM();
    return true;
}
Ejemplo n.º 3
0
Agents::SimulatorInterface* SimulatorDBEntry::getSimulator(
    size_t& agentCount, float& simTimeStep, size_t subSteps, float simDuration,
    const std::string& behaveFile, const std::string& sceneFile, const std::string& outFile,
    const std::string& scbVersion, bool verbose) {
  _sim = initSimulator(sceneFile, verbose);
  if (!_sim) {
    return 0x0;
  }
  // TODO: Remove time step from the simulator specification!
  float specTimeStep = _sim->getTimeStep();

  _fsm = initFSM(behaveFile, _sim, verbose);
  if (!_fsm) {
    return 0x0;
  }
  if (!finalize(_sim, _fsm)) {
    delete _sim;
    delete _fsm;
    return 0x0;
  }

  if (simTimeStep > 0.f) {
    if (verbose) {
      logger << Logger::INFO_MSG;
      logger << "Simulation time step set by command-line argument: ";
      logger << simTimeStep << ".";
    }
    _sim->setTimeStep(simTimeStep);
  } else {
    simTimeStep = specTimeStep;
    if (verbose) {
      logger << Logger::INFO_MSG << "Simulation time step set by specification file: ";
      logger << specTimeStep << ".";
    }
  }
  _sim->setSubSteps(subSteps);
  float effTimeStep = simTimeStep / (1.f + subSteps);
  logger << Logger::INFO_MSG << "For logical time step: " << simTimeStep << " and ";
  logger << subSteps << " sub step";
  if (subSteps != 1) {
    logger << "s";
  }
  logger << ", effective time step is: " << effTimeStep;

  _sim->setMaxDuration(simDuration);
  if (outFile != "") {
    _sim->setOutput(outFile, scbVersion);
  }
  agentCount = _sim->getNumAgents();
  return _sim;
}
/**
 * Initialise the module, called on startup
 * \returns 0 on success or -1 if initialisation failed
 */
int32_t VtolLandFSM::Initialize(VtolPathFollowerSettingsData *ptr_vtolPathFollowerSettings,
                                PathDesiredData *ptr_pathDesired,
                                FlightStatusData *ptr_flightStatus)
{
    PIOS_Assert(ptr_vtolPathFollowerSettings);
    PIOS_Assert(ptr_pathDesired);
    PIOS_Assert(ptr_flightStatus);

    if (mLandData == 0) {
        mLandData = (VtolLandFSMData_T *)pios_malloc(sizeof(VtolLandFSMData_T));
        PIOS_Assert(mLandData);
    }
    memset(mLandData, sizeof(VtolLandFSMData_T), 0);
    vtolPathFollowerSettings = ptr_vtolPathFollowerSettings;
    pathDesired  = ptr_pathDesired;
    flightStatus = ptr_flightStatus;
    initFSM();

    return 0;
}
Ejemplo n.º 5
0
/**
 * Initialise the module, called on startup
 * \returns 0 on success or -1 if initialisation failed
 */
int32_t VtolBrakeFSM::Initialize(VtolPathFollowerSettingsData *ptr_vtolPathFollowerSettings,
                                 PathDesiredData *ptr_pathDesired,
                                 FlightStatusData *ptr_flightStatus,
                                 PathStatusData *ptr_pathStatus)
{
    PIOS_Assert(ptr_vtolPathFollowerSettings);
    PIOS_Assert(ptr_pathDesired);
    PIOS_Assert(ptr_flightStatus);

    // allow for Initialize being called more than once.
    if (!mBrakeData) {
        mBrakeData = (VtolBrakeFSMData_T *)pios_malloc(sizeof(VtolBrakeFSMData_T));
        PIOS_Assert(mBrakeData);
    }
    memset(mBrakeData, 0, sizeof(VtolBrakeFSMData_T));
    vtolPathFollowerSettings = ptr_vtolPathFollowerSettings;
    pathDesired  = ptr_pathDesired;
    flightStatus = ptr_flightStatus;
    pathStatus   = ptr_pathStatus;
    initFSM();

    return 0;
}
Ejemplo n.º 6
0
bool MonsterRush::init()
{
	if (!BaseComponent::init())
	{
		return false;
	}

	m_Type = OT_MONSTER_RUSH;

	//물리 초기화

	auto meterial = cocos2d::PhysicsMaterial(0, 0, 0);
	m_Body = cocos2d::PhysicsBody::createBox(cocos2d::Size(RUSH_WIDTH, RUSH_HEIGHT), meterial, cocos2d::Point(0, 0));
	m_Body->setContactTestBitmask(PHYC_BLOCK | PHYC_PLAYER | PHYC_MISSILE);
	m_Body->setCategoryBitmask(PHYC_MONSTER);
	m_Body->setCollisionBitmask(PHYC_BLOCK | PHYC_FLOOR | PHYC_MISSILE);
	m_Body->setMass(10);
	m_Body->setRotationEnable(false);
	m_Body->setVelocityLimit(1000);
	m_Body->setVelocity(cocos2d::Vec2(0, 0));
	m_Body->setDynamic(true);
	m_Body->retain();
	setPhysicsBody(m_Body);

	//FSM 초기화
	initFSM(1);
	m_States[0] = STAT_IDLE;

	m_FSMs[0].resize(STAT_NUM);
	m_FSMs[0][STAT_IDLE] = nullptr;
	m_FSMs[0][STAT_MOVE] = move;
	m_FSMs[0][STAT_KNOCKBACK] = CommonState::knockback;

	m_Transitions[0].resize(STAT_NUM);
	m_Transitions[0][STAT_IDLE] = idleTransition;
	m_Transitions[0][STAT_MOVE] = moveTransition;
	m_Transitions[0][STAT_KNOCKBACK] = FSM_CALLBACK(MonsterRush::knockbackTransition, this);


	m_Renders[0].resize(STAT_NUM);
	m_Renders[0][STAT_IDLE] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	( (AnimationComponent*) m_Renders[0][STAT_IDLE] )->setAnimation(AT_MONSTER_RUSH_IDLE, this);
	m_Renders[0][STAT_MOVE] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	( (AnimationComponent*) m_Renders[0][STAT_MOVE] )->setAnimation(AT_MONSTER_RUSH_MOVE, this);
	m_Renders[0][STAT_KNOCKBACK] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	((AnimationComponent*)m_Renders[0][STAT_KNOCKBACK])->setAnimation(AT_MONSTER_RUSH_IDLE, this);

	for(int i = 0; i < m_Renders[0].size(); i++)
	{
		addComponent(m_Renders[0][i]);
	}

	//info 설정
	auto data = GET_DATA_MANAGER()->getMonsterInfo(OT_MONSTER_RUSH);

	if (data != nullptr)
	{
		m_Info = *GET_DATA_MANAGER()->getMonsterInfo(OT_MONSTER_RUSH);
	}

	m_Info.m_CurrentHp = m_Info.m_MaxHp;

	return true;
}
Ejemplo n.º 7
0
bool Commander::init(){
    initFSM();
    _scorer = Controller::getInstance()->getScorer();
    return true;
}
void VtolLandFSM::Inactive(void)
{
    memset(mLandData, sizeof(VtolLandFSMData_T), 0);
    initFSM();
}
Ejemplo n.º 9
0
bool MonsterDevil::init()
{
	if (!BaseComponent::init())
	{
		return false;
	}

	m_Type = OT_MONSTER_DEVIL;
	m_PathFinder = new PathFinderByBFS();

	////info 설정
	auto data = GET_DATA_MANAGER()->getMonsterInfo(OT_MONSTER_DEVIL);

	if (data != nullptr)
	{
		m_Info = *GET_DATA_MANAGER()->getMonsterInfo(OT_MONSTER_DEVIL);
	}

	m_Info.m_CurrentHp = m_Info.m_MaxHp;



	//물리 초기화

	auto meterial = cocos2d::PhysicsMaterial(0, 0, 0);
	m_Body = cocos2d::PhysicsBody::createBox(cocos2d::Size(m_Info.m_Size.width, m_Info.m_Size.height), meterial, cocos2d::Point(0, 0));
	m_Body->setContactTestBitmask(PHYC_BLOCK | PHYC_PLAYER | PHYC_MISSILE | PHYC_FLOOR);
	m_Body->setCategoryBitmask(PHYC_MONSTER);
	m_Body->setCollisionBitmask(PHYC_BLOCK | PHYC_MISSILE);
	m_Body->setMass(10);
	m_Body->setRotationEnable(false);
	m_Body->setVelocityLimit(1000);
	m_Body->setVelocity(cocos2d::Vec2(0, 0));
	m_Body->setDynamic(true);
	m_Body->setGravityEnable(false);
	m_Body->retain();
	setPhysicsBody(m_Body);


	initFSM(1);
	m_States[0] = STAT_IDLE;

	m_FSMs[0].resize(STAT_NUM);
	m_FSMs[0][STAT_IDLE] = nullptr;
	m_FSMs[0][STAT_MOVE] = FSM_CALLBACK(MonsterDevil::move, this);
	m_FSMs[0][STAT_READYATTACK] = FSM_CALLBACK(MonsterDevil::readyAttack, this);
	m_FSMs[0][STAT_ATTACK] = FSM_CALLBACK(MonsterDevil::attack, this);

	m_Transitions[0].resize(STAT_NUM);
	m_Transitions[0][STAT_IDLE] = FSM_CALLBACK(MonsterDevil::idleTransition, this);
	m_Transitions[0][STAT_MOVE] = FSM_CALLBACK(MonsterDevil::moveTransition, this);
	m_Transitions[0][STAT_READYATTACK] = FSM_CALLBACK(MonsterDevil::readyAttackTransition, this);
	m_Transitions[0][STAT_ATTACK] = FSM_CALLBACK(MonsterDevil::attackTransition, this);


	m_Renders[0].resize(STAT_NUM);
	m_Renders[0][STAT_IDLE] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	((AnimationComponent*)m_Renders[0][STAT_IDLE])->setAnimation(AT_DEVIL_IDLE, this);
	m_Renders[0][STAT_MOVE] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	((AnimationComponent*)m_Renders[0][STAT_MOVE])->setAnimation(AT_DEVIL_MOVE, this);
	m_Renders[0][STAT_READYATTACK] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	((AnimationComponent*)m_Renders[0][STAT_READYATTACK])->setAnimation(AT_DEVIL_IDLE, this);
	m_Renders[0][STAT_ATTACK] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	((AnimationComponent*)m_Renders[0][STAT_ATTACK])->setAnimation(AT_DEVIL_ATTACK, this, 1, true);

	for (unsigned int i = 0; i < m_Renders[0].size(); i++)
	{
		addComponent(m_Renders[0][i]);
	}

	//arrow 설정
	m_ArrowAniComponent = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	m_ArrowAniComponent->setAnimation(AT_DEVIL_ARROW, this, 2, true);
	addComponent(m_ArrowAniComponent);



	return true;
}
Ejemplo n.º 10
0
void VtolBrakeFSM::Inactive(void)
{
    memset(mBrakeData, 0, sizeof(VtolBrakeFSMData_T));
    initFSM();
}