本文整理汇总了C++中Mover类的典型用法代码示例。如果您正苦于以下问题:C++ Mover类的具体用法?C++ Mover怎么用?C++ Mover使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mover类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move_scene
int Scene_Common::req_enter_scene_outpost(const int64_t monster_role_id) {
Move_Scene* scene = move_scene();
if(!scene) {
return 0;
}
Single_Scene* single_scene = dynamic_cast<Single_Scene*>(scene);
if(!single_scene) {
return 0;
}
Mover* mover = single_scene->find_mover_with_layer(0, monster_role_id);
if(!mover || mover->monster_self() == NULL) {
return 0;
}
// 没有收益的玩家不能进去
if(scene->is_no_profit(role_id())) {
return ERROR_FB_ENTER_TBAY_NO_PROFIT;
}
int target_scene_id = 0;
int target_scene_time = 0;
int target_scene_type = 0;
mover->monster_self()->get_ex_param(target_scene_id, target_scene_time, target_scene_type);
if(target_scene_id == 0) {
return 0;
}
player_self()->inner_transmit(target_scene_id,0,monster_role_id);
return 0;
}
示例2: setup
//--------------------------------------------------------------
void ofApp::setup(){
for(int i = 0; i<50; i++){
Mover mInst;
mInst.setup();
mList.push_back(mInst);
}
}
示例3: initializeLogData
void Logistics::initializeLogData()
{
LogisticsData::instance->removeMechsInForceGroup();
LogisticsData::instance->init();
Team* pTeam = Team::home;
if ( pTeam )
{
for ( int i = pTeam->getRosterSize() - 1; i > -1; i-- )
{
Mover* pMover = (Mover*)pTeam->getMover( i );
LogisticsPilot* pPilot = LogisticsData::instance->getPilot(pMover->getPilot()->getName());
unsigned long base, highlight1, highlight2;
((Mech3DAppearance*)pMover->getAppearance())->getPaintScheme( highlight1,
highlight2, base );
if ( pMover->getObjectType()->getObjectTypeClass() == BATTLEMECH_TYPE )
{
LogisticsVariant* pVar = LogisticsData::instance->getVariant( ((BattleMech*)pMover)->variantName );
LogisticsData::instance->addMechToInventory(
pVar, 1, pPilot,
base, highlight1, highlight2 );
}
}
}
}
示例4: printGrid
void Grid::printGrid(Mover mover)
{
int i = 0;
int j = 0;
int curX = mover.getX();
int curY = mover.getY();
std::cout << std::endl;
for(i = 0; i < length; ++i)
{
for(j = 0; j < width; ++j)
{
if((curX == i) && (curY == j))
std::cout << "|M| ";
else if(cells[i][j].isGoal())
std::cout << "|G| ";
else if(cells[i][j].isBlockFunc() == true)
std::cout << "||| ";
else
std::cout << "|" << cells[i][j].getData() << "| ";
}
std::cout << std::endl;
std::cout << std::endl;
}
}
示例5:
const Vec2f Mover::attract( const Mover& m, const float g ) const
{
auto force = location - m.getLocation();
auto distance = force.lengthSquared();
distance = ( distance < 25.0f ) ? 25.0f : ( ( distance > 625.0f ) ? 625.0 : distance );
force.normalize();
force *= g * mass * m.getMass() / ( distance );
return force;
}
示例6: startThread
//static method
void* startThread(void* mover)
{
Mover* m = reinterpret_cast<Mover*>(mover);
assert(m);
printf(" thread starting pid=%d self=%lu\n", getpid(), pthread_self());
m->start();
sleep(200);
printf(" thread finished\n");
return 0;
}
示例7: ofBackground
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(255);
// mover.setup(50, 500);
for (int i=0; i<NUM; i++) {
Mover mover;
float x = ofRandomWidth();
float y= ofRandomHeight();
mover.setup(x, y);
moverList.push_back(mover);
}
}
示例8: ofBackground
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(0);
for (int y = 0; y < ofGetWidth(); y+=20) {
for (int x = 0; x < ofGetWidth(); x+=20) {
Mover mover;
mover.setup(x, y, 0.5);
moverList.push_back(mover);
}
}
}
示例9: outpost_notice_exit
void Single_Scene::outpost_notice_exit(const int64_t monster_role_id, bool clear_single){
if(monster_role_id != 0){
Mover* mover = this->find_mover_with_layer(0, monster_role_id);
if(mover && mover->monster_self()){
mover->exit_move_scene();
}
}
if(clear_single){
this->set_scene_status(Move_Scene::SCENE_RECOVER_STATUS);
MSG_DEBUG("single scene recover outpost notice, scene id:%ld", this->scene_id());
recover_time_ = Time_Value::zero;
}
}
示例10: while
void RenderQueue::_pushRenderer(SceneNode * node)
{
if (node->_getVisibleMask())
{
SceneNode::MoverVisitor vr = node->GetMovers();
while (!vr.Endof())
{
Mover * m = *vr.Cursor();
if (m->IsVisible())
m->AddRenderQueue(this);
++vr;
}
}
}
示例11: listMotionTypes
void listMotionTypes()
{
#if __cplusplus <= 199711L
static const int arr[] = {16,2,77,29};
std::vector<int> int_vec (arr, arr + sizeof(arr) / sizeof(arr[0]) );
static const MotionType mta[] = {SCOOP_TYPE_1, SCOOP_TYPE_2};
std::vector<MotionType> template_arg_vec (mta, mta + sizeof(mta) / sizeof(mta[0]) );
#else
// NOTE: g++ -std=c++11 OR clang++ -std=c++11
std::vector <int> int_vec = {1, 2, 3, 4, 5};
std::vector<MotionType> template_arg_vec = {SCOOP_TYPE_1, SCOOP_TYPE_2};
#endif
for (int j = FIRST_MotionType; j < NUM_MotionTypes; j++) {
MotionType typer = template_arg_vec[j];
printf("MotionType(%d)\n", typer);
// const int tt = static_cast<int>(typer); // fails because value is not known at compile time
// Mover<tt> mover; // error: non-type template argument of type 'int' is not an integral constant expression
Mover<SCOOP_TYPE_1> mover;
mover.showMover();
}
}
示例12: computeEvadeSteering
ofPoint Mover::computeEvadeSteering(const Mover &mover, const float maxPredictionTime) const {
ofPoint offset = mover.pos - pos;
float dist = offset.length();
float dangerSpeed = mover.vel.length();
if (dangerSpeed == 0.0f)
dangerSpeed = 1.0f;
float time = dist / dangerSpeed;
if (time > maxPredictionTime)
time = maxPredictionTime;
ofPoint target = mover.predictFuturePosition(time);
return computeFleeSteering(target);
}
示例13: attract
ofVec2f Attractor::attract(Mover m){
ofVec2f force = location - m.getLocation(); // Calculate direction of force
float d = force.length(); // Distance between objects
d = ofClamp(d,5.0,25.0);
force.normalize(); // Normalize vector (distance doesn't matter here, we just want this vector for direction)
float strength = (G * mass * m.mass) / (d * d); // Calculate gravitional force magnitude
force *= strength; // Get force vector --> magnitude * direction
return force;
}
示例14: computePursuitSteering
ofPoint Mover::computePursuitSteering(const Mover &mover, const float maxPredictionTime) const {
ofPoint offset = mover.pos - pos;
float dist = offset.length();
float parallelness = vel.normalized().dot(mover.vel.normalized());
float quaryForwardness = vel.normalized().dot(offset.normalized());
float directTravelTime = vel.normalized().dot(offset.normalized());
int f = intervalCompare(quaryForwardness, -0.707, 0.707);
int p = intervalCompare(parallelness, -0.707, 0.707);
float timeFactor = 0;
switch (f) {
case 1:
switch (p) {
case 1: // ahead, parallel
timeFactor = 4;
break;
case 0: // ahead, perpendicular
timeFactor = 1.8;
break;
case -1: // ahead, anti-parallel
timeFactor = 0.85;
break;
}
break;
case 0:
switch (p){
case 1: // aside, parallel
timeFactor = 1;
break;
case 0: // aside, perpendicular
timeFactor = 0.8;
break;
case -1: // aside, anti-parallel
timeFactor = 4;
break;
}
case -1:
switch (p){
case 1: // behind, parallel
timeFactor = 0.5;
break;
case 0: // behind, perpendicular
timeFactor = 2;
break;
case -1: // behind, anti-parallel
timeFactor = 2;
break;
}
}
float et = directTravelTime * timeFactor;
float etl = (et > maxPredictionTime) ? maxPredictionTime : et;
ofPoint target = mover.predictFuturePosition(etl);
return computeSteering(target, false);
}
示例15: scene_config
int Single_Scene::scene_pass_to_logic(void){
if(is_scene_pass_ == false){
if(is_scene_complete_){
this->is_delay_show_ts_point_= true;
this->reset_delay_show_ts_point_time();
}
return -1;
}
if(has_gain_rewards){
return 0;
}
has_gain_rewards = true;
MSG_20200080 msg;
if(scene_config() && scene_config()->dungeon.first_layer_id != 0){
msg.scene_id = scene_config()->dungeon.first_layer_id;
}else{
msg.scene_id = scene_id();
}
Mover *mover = this->find_mover_with_layer(0, role_id_);
if (mover) {
if(is_no_profit(mover->role_id())){// 没收益
msg.result = 0;
this->is_delay_show_ts_point_= true;
this->reset_delay_show_ts_point_time();
}else{// 有收益
msg.result = 1;
this->is_delay_show_ts_point_= true;
if(has_scene_pass_box_ || scene_config()->type == FuBen_Scene_Type){
this->ts_point_delay_time_ = Time_Value::gettimeofday() + Time_Value(12);
}else{
this->reset_delay_show_ts_point_time();
}
}
OBJ_SEND_TO_LOGIC(msg, (*mover));
}
return 0;
}