#pragma once #include #include "../dxd_math.hpp" #include "world_object.hpp" #include "af_spawner.hpp" namespace dxd::sim { class AFSpawner; class Airfield : public WorldObject { private: AFSpawner *_parent; vec2 _position; int _ttl; int _next_spawn; float _rw_heading; int _pending_arrivals; int const _MIN_TAKEOFF_DELAY = 600; int const _MAX_TAKEOFF_DELAY = 3000; int const _RW_LENGTH = 6; float const _APPROACH_DIST = 20.0f; public: Airfield(AFSpawner *parent, vec2 position, int ttl, float rw_heading) : _parent(parent), _position(position), _ttl(ttl), _rw_heading(rw_heading) { _next_spawn = _MIN_TAKEOFF_DELAY; } vec2 get_position() { return _position; } vec2 get_approach_point(); void going_to() { ++_pending_arrivals; } void arrived_at() { --_pending_arrivals; } bool is_active() { return _ttl > 0; } void tick(float timestep, World *world) override; void draw(Renderer *rend) override; }; } // namespace dxd::sim