void SpriteGroup::Update(const float& delta) { Element::Update(delta); for (int i = 0; i < m_sprite_list.size(); ++i) { Sprite* sprite = m_sprite_list.at(i); sprite->SetPosition( sprite->GetPositionX() + GetPositionX(), sprite->GetPositionY() + GetPositionY(), sprite->GetPositionZ() + GetPositionZ()); sprite->SetAngle( sprite->GetAngleX() + GetAngleX(), sprite->GetAngleY() + GetAngleY(), sprite->GetAngleZ() + GetAngleZ()); sprite->SetAnchor( (sprite->GetAnchorX() + GetAnchorX()) / 2.0f, (sprite->GetAnchorY() + GetAnchorY()) / 2.0f); sprite->SetScale( sprite->GetScaleX() * GetScaleX(), sprite->GetScaleY() * GetScaleY()); sprite->Update(delta); } }
void SpriteGroup::Render() { Element::Render(); for (int i = 0; i < m_sprite_list.size(); ++i) { Sprite* sprite = m_sprite_list.at(i); sprite->Render(); sprite->SetPosition( sprite->GetPositionX() - GetPositionX(), sprite->GetPositionY() - GetPositionY(), sprite->GetPositionZ() - GetPositionZ()); sprite->SetAngle( sprite->GetAngleX() - GetAngleX(), sprite->GetAngleY() - GetAngleY(), sprite->GetAngleZ() - GetAngleZ()); sprite->SetAnchor( sprite->GetAnchorX() * 2.0f - GetAnchorX(), sprite->GetAnchorY() * 2.0f - GetAnchorY()); if (GetScaleX() != 0) { sprite->SetScaleX(sprite->GetScaleX() / GetScaleX()); } if (GetScaleY() != 0) { sprite->SetScaleY(sprite->GetScaleY() / GetScaleY()); } } }
bool BulletLauncher::Shoot() { // 如果标记可以射击才会发射出子弹 if (_bShoot) { Bullet* bullet = CreateBullet(); bullet->SetPosition( GetPositionX(), GetPositionY(), GetPositionZ()); bullet->SetAngleZ(GetAngleZ()); bullet->SetDirectionAngle(GetAngleZ()); bullet->SetOrder(GetOrder()); _belongPlane->GetScene()->Add(bullet); // 发射过了,标记为不可发射 _bShoot = false; return true; } return false; }
/** * {@inheritDoc} */ void ADIS16448_IMU::UpdateTable() { auto table = GetTable(); if (table) { table->PutNumber("Value", GetAngle()); table->PutNumber("Pitch", GetPitch()); table->PutNumber("Roll", GetRoll()); table->PutNumber("Yaw", GetYaw()); table->PutNumber("AccelX", GetAccelX()); table->PutNumber("AccelY", GetAccelY()); table->PutNumber("AccelZ", GetAccelZ()); table->PutNumber("AngleX", GetAngleX()); table->PutNumber("AngleY", GetAngleY()); table->PutNumber("AngleZ", GetAngleZ()); } }