ca61bae014
- Add Entity Tree View used to select entities to be modified - Add Entity View used to Add/Remove/Edit Components of the Entity - Add Asset View which lists all available assets
22 lines
593 B
C++
22 lines
593 B
C++
#pragma once
|
|
|
|
#include "copium/ecs/System.h"
|
|
#include "copium/example/Components.h"
|
|
|
|
namespace Copium
|
|
{
|
|
class CameraFollowPlayerSystem : public System<PlayerC, TransformC>
|
|
{
|
|
public:
|
|
void RunEntity(Entity entity, PlayerC& player, TransformC& transform) override
|
|
{
|
|
if (!ValidateEntity<TransformC>(player.camera))
|
|
return;
|
|
|
|
TransformC& cameraTransform = player.camera.GetComponent<TransformC>();
|
|
glm::vec2 wantedPos = transform.position + transform.size * 0.5f;
|
|
cameraTransform.position -= (cameraTransform.position - wantedPos) * 0.10f;
|
|
}
|
|
};
|
|
}
|