CoriEngine
Loading...
Searching...
No Matches
TriggerBehaviour.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace Cori {
5 namespace World {
6 namespace Components {
7 namespace Entity {
8 class Trigger;
9 }
10 }
11
16 public:
17 virtual ~TriggerBehaviour() = default;
18 [[nodiscard]] virtual const char* GetDebugName() const { return "Unnamed Trigger"; }
19 protected:
26 virtual void OnEnter([[maybe_unused]] Entity& visitor, [[maybe_unused]] Entity& trigger) {}
27
34 virtual void OnTickUpdate([[maybe_unused]] Entity& visitor, [[maybe_unused]] Entity& trigger, [[maybe_unused]] float timestep) {}
35
41 virtual void OnExit([[maybe_unused]] Entity& visitor, [[maybe_unused]] Entity& trigger) {}
42
43
44 // maybe add an onevent func
45 };
46 }
47}
A Trigger components is used in combination with RigidBody component used to respond to an entity get...
Entities are the essential part of WorldSystem.
Definition Entity.hpp:25
An abstract class meant to be used with Trigger component. Derive from it to create a trigger behavio...
virtual void OnEnter(Entity &visitor, Entity &trigger)
Will be fired when an entity enter the Trigger zone.
virtual void OnTickUpdate(Entity &visitor, Entity &trigger, float timestep)
Fired every tick when an Entity is inside the Trigger zone. Expect for the very first tick the Entity...
virtual void OnExit(Entity &visitor, Entity &trigger)
Fired very last tick when an Entity leaves the Trigger zone.
virtual const char * GetDebugName() const
virtual ~TriggerBehaviour()=default
Components designed to be used with entities.
Components that are used with the WorldSystem (ECS).
Anything connected to WorldSystem (ECS) is in this namespace.
Global engine namespace.