void TriggerTerrainBlock::startTerrainChange() { // Get the grid zone component on this object. GridZone* zone = this->GetObject()->GetComponent<GridZone>(); ASSERT(zone != nullptr, "Object %d with TriggerElevationChange component also has GridZone component", this->GetObject()->GetId()); if (zone != nullptr) { int west, east, south, north; zone->GetZoneBounds(west, east, south, north); GameGrid* grid = SINGLETONS->GetGridManager()->GetGrid(); int elevation = grid->GetElevationFromWorldY(this->GetObject()->GetComponent<Transform>()->GetPositionWorld().y); for (int x = west; x <= east; ++x) { for (int z = south; z <= north; ++z) { if (this->changeWalkability) { grid->SetCellPassableAtElevation(x, z, elevation, this->isPassable); } if (this->changeVisibility) { grid->SetCellVisibleAtElevation(x, z, elevation, this->isPassable); } } } } // Navigators need to update their pathfinding MessageChunk gridNavMessage = ENGINE->GetMessageHub()->GetOneFreeMessage(); gridNavMessage->SetMessageType(MESSAGE_TYPE_GRID_NAVIGATION_REFRESH); ENGINE->GetMessageHub()->SendMulticastMessage(gridNavMessage, SINGLETONS->GetGridManagerObject()->GetId()); }
void MessageHub::SendMulticastMessage(MessageType messageType, ObjectIdType senderId) { MessageChunk messageChunk = this->GetOneFreeMessage(); messageChunk->SetMessageType(messageType); this->SendMulticastMessage(messageChunk, senderId); }
void MessageHub::SendPointcastMessage(MessageType messageType, ObjectIdType receiverId, ObjectIdType senderId) { MessageChunk messageChunk = this->GetOneFreeMessage(); messageChunk->SetMessageType(messageType); this->SendPointcastMessage(messageChunk, receiverId, senderId); }