summaryrefslogtreecommitdiff
path: root/src/engine/TrainCrossing.h
blob: eeb6b5fc2daed2d2bb6c7b2bf7d8ba1a14be699d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <libultraship.h>

extern "C" {
#include "common_structs.h"
}

/**
 * @brief TrainCrossing class
 * @arg Vec3f position of the crossing
 * @arg u32 waypointMin
 * @arg u32 waypointMax
 * 
 * Min/Max are used to determine the range for AI to stop for the crossing.
 * 
 */
class TrainCrossing {
public:
    TrainCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius);

    Vec3f Position;
    s32 OnTriggered = 0;
    u32 Timer;
    u32 WaypointMin;
    u32 WaypointMax;

    f32 ApproachRadius;
    f32 ExitRadius;

    virtual void CrossingTrigger();
    virtual void AICrossingBehaviour(s32 playerId);
    f32 Distance(Vec3f a, Vec3f b);
    f32 DynamicRadius(Vec3f trainPos, Vec3f trainVelocity, Vec3f crossingPos);
};