void CLevitate::Update(float timeDelta) { float a; if(!arxtime.is_paused()) { this->currdurationang += timeDelta; ulCurrentTime += timeDelta; this->currframetime = timeDelta; m_stoneDelay -= timeDelta; } //animation cone this->ang = (float)this->currdurationang / 1000.f; if(this->ang > 1.f) { this->currdurationang = 0; this->ang = 1.f; } int dustParticles = 0; switch(this->key) { case 0: //monté du cone a = (float) ulCurrentTime / 1000.f; if(a > 1.f) { a = 0.f; this->key++; } m_coneScale = a; dustParticles = 3; break; case 1: //animation cone m_coneScale = (float)ulCurrentTime / (float)ulDuration; if(ulCurrentTime >= ulDuration) { m_coneScale = 1.f; this->key++; } dustParticles = 10; break; } for(int i = 0; i < dustParticles; i++) { createDustParticle(); } if(m_stoneDelay <= 0) { m_stoneDelay = Random::get(50, 150); AddStone(m_pos + randomOffsetXZ(m_baseRadius)); } }
void AIManager::debugAnimal() { AddAnimal(GAZELLE, Ogre::Vector3(100, 270, 200)); AddAnimal(OSTRICH, Ogre::Vector3(-100, 270, 200)); AddAnimal(GOOSE, Ogre::Vector3(200, 270, 200)); AddAnimal(DUCK, Ogre::Vector3(200, 270, 200)); AddAnimal(BIRD, Ogre::Vector3(100, 270, 100)); AddAnimal(CROCODILE, Ogre::Vector3(-100, 270, 100)); AddStone(Ogre::Vector3(-100, 270, 200)); }
void AIManager::spawnStone(float time2) { srand (time(NULL)); spawnStoneTimer-= time2; if (spawnStoneTimer <= 0) { spawnStoneTimer = spawnStoneCD; float x = ((rand()%2 * 2) - 1) * 30; float z = 2000 + World::getSingleton()->getCarNode()->getPosition().z; AddStone(Ogre::Vector3(x, Geometry::getSingleton()->getGroundY(x,z)+80, z)); } }
const GoMove* GoBoard::Play(int p, int color) { if(!IsLegal(p, color)) { std::stringstream ss; ss<<"Illegal move at "<<ReadablePosition(p)<<std::endl;//throw "Illegal move at "; throw Exception(ss.str()); } AddStone(p,color); State.toPlay = color==S_WHITE ? S_BLACK : S_WHITE; //Inverse color. moves[movePointer]->Color = color; moves[movePointer++]->Point = ReversePos(p,color); return 0; }