/* * LightPhysicsComponent.cpp * * Created on: Oct 9, 2019 * Author: fredrick */ #include "LightPhysicsComponent.h" namespace JamSpook { LightPhysicsComponent::LightPhysicsComponent(mat4 transform, shared_ptr > > entity, weak_ptr > physicsSystem, weak_ptr > > physicsCollisionSubSystem, weak_ptr > > physicsColliderQuerySubSystem, shared_ptr collider): PhysicsComponent(transform, entity, physicsSystem, physicsCollisionSubSystem, physicsColliderQuerySubSystem, collider) {} LightPhysicsComponent::~LightPhysicsComponent() {} void LightPhysicsComponent::update(const milliseconds dtms) { // Log::write(LogLevel::trace, "CollectablePhysicsComponent - update"); PhysicsComponent::update(dtms); } void LightPhysicsComponent::onICCMessage(shared_ptr message) { PhysicsComponent::onICCMessage(message); // DirectionChangeMessage if (message->getMessageType() == IDCache::get("DirectionChangeMessage")) { Log::write(LogLevel::debug, "PlayerPhysicsComponent - onICCMessage - DirectionChangeMessage"); shared_ptr msg = dynamic_pointer_cast(message); if (msg->getNewDirection() != vec3(0,0,0)) { mDirection = msg->getNewDirection(); mCollider->setLinearVelocity(msg->getNewDirection()*4.0f); // Log::write(LogLevel::trace, "PlayerPhysicsComponent - onICCMessage - DirectionChangeMessage - " + glm::to_string(msg->getNewDirection()*4.0f)); // BroadcastObservable::broadcast(msg->getPosition(), msg->getNewDirection()); } } } void LightPhysicsComponent::onCollision(const string& tag) { // nothing } } // namespace JamSpook