MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / update

Method update

Source/GameObject.cpp:382–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380}
381
382void GameObject::update()
383{
384 if (getEnterEffectID() == 0)
385 {
386 // setPosition(_startPosition);
387 setScaleX(_startScale.x);
388 setScaleY(_startScale.y);
389 }
390
391 auto bgl = PlayLayer::getInstance();
392 if (!bgl)
393 return;
394
395 if (!_isTrigger)
396 this->setPosition(this->_startPosition + this->_startPosOffset);
397
398 float opacityMultiplier = 1.f;
399
400 ax::Color3B groupColor;
401 GroupProperties::GroupState state = GroupProperties::GroupState::NOT_CHANGING;
402
403 for (int i : _groups | std::views::reverse)
404 {
405 opacityMultiplier *= bgl->_groups[i]._alpha;
406 if (bgl->_groups[i].groupState != GroupProperties::GroupState::NOT_CHANGING)
407 {
408 groupColor = bgl->_groups[i]._color;
409 state = bgl->_groups[i].groupState;
410 }
411 }
412
413 if(!_mainColor) _mainColor = bgl->_colorChannels.contains(_mainColorChannel) ? &bgl->_colorChannels[_mainColorChannel] : nullptr;
414 if(!_secColor) _secColor = bgl->_colorChannels.contains(_secColorChannel) ? &bgl->_colorChannels[_secColorChannel] : nullptr;
415
416 switch (_childSpritesChannel[0])
417 {
418 case 0:
419
420 if (state == GroupProperties::GroupState::MAIN_ONLY || state == GroupProperties::GroupState::MAIN_DETAIL)
421 _tempColor = groupColor;
422 else
423 applyColorChannel(this, 0, opacityMultiplier, _mainColor);
424
425 if (_mainHSVEnabled)
426 GameToolbox::applyHSV(_mainHSV, &_tempColor);
427
428 if (getColor() != _tempColor)
429 setColor(_tempColor);
430 break;
431 case 1:
432
433 if (state == GroupProperties::GroupState::DETAIL_ONLY || state == GroupProperties::GroupState::MAIN_DETAIL)
434 _tempColor = groupColor;
435 else if (_secColor)
436 applyColorChannel(this, 1, opacityMultiplier, _secColor);
437 else
438 applyColorChannel(this, 1, opacityMultiplier, _mainColor);
439

Callers

nothing calls this directly

Calls 4

setPositionMethod · 0.95
sizeMethod · 0.80
getColorMethod · 0.80
setColorMethod · 0.45

Tested by

no test coverage detected