spooky-game/src/entities/LightPhysicsComponent.h

81 lines
2.3 KiB
C++

/*
* LightPhysicsComponent.h
*
* Created on: Oct 9, 2019
* Author: fredrick
*/
#ifndef LIGHTPHYSICSCOMPONENT_H_
#define LIGHTPHYSICSCOMPONENT_H_
#include <chrono>
#include <memory>
#include <cstdint>
#include <string>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <ecos/utility/Random.h>
#include <ecos/core/IDCache.h>
#include <ecos/core/Log.h>
#include <ecos/core/Message.h>
#include <ecos/core/BroadcastObservable.h>
#include <ecos/physics/PhysicsSystem.h>
#include <ecos/physics/TransformChangeMessage.h>
#include <ecos/physics/CollisionStateChangeMessage.h>
#include <ecos/physics/ColliderQueryMessage.h>
#include <ecos/physics/PhysicsComponent.h>
#include <ecos/physics/Collider.h>
#include "../messages/DirectionChangeMessage.h"
namespace JamSpook {
using std::chrono::milliseconds;
using std::weak_ptr;
using std::shared_ptr;
using std::make_shared;
using std::dynamic_pointer_cast;
using std::string;
using glm::vec3;
using glm::mat4;
using glm::translate;
using glm::scale;
using ecos::utility::getFloatInRange;
using ecos::core::IDCache;
using ecos::core::logging::Log;
using ecos::core::logging::LogLevel;
using ecos::core::Message;
using ecos::core::BroadcastObservable;
using ecos::physics::PhysicsSystem;
using ecos::physics::PhysicsComponent;
using ecos::physics::Collider;
using ecos::physics::TransformChangeMessage;
using ecos::physics::CollisionStateChangeMessage;
using ecos::physics::ColliderQueryMessage;
class LightPhysicsComponent:
public ecos::physics::PhysicsComponent
{
private:
vec3 mDirection;
public:
LightPhysicsComponent(mat4 transform,
shared_ptr<BroadcastObservable<shared_ptr<Message> > > entity,
weak_ptr<BroadcastObservable<const milliseconds> > physicsSystem,
weak_ptr<BroadcastObservable<shared_ptr<CollisionStateChangeMessage> > > physicsCollisionSubSystem,
weak_ptr<BroadcastObservable<shared_ptr<ColliderQueryMessage> > > physicsColliderQuerySubSystem,
shared_ptr<Collider> collider);
virtual ~LightPhysicsComponent();
virtual void update(const milliseconds dtms);
virtual void onICCMessage(shared_ptr<Message> message);
virtual void onCollision(const string& tag);
};
} // namespace JamSpook
#endif // LIGHTPHYSICSCOMPONENT_H_