# Rally Rush: godot::Drone Class Reference

Loading...
Searching...
No Matches
godot::Drone Class Reference

An enemy drone, moves around using navigation. Model is expected to float well above the transform origin. More...

`#include <drone.hpp>`

Inheritance diagram for godot::Drone:

## Public Member Functions

virtual void | _ready () override
| Get required object references and connect observers.
virtual void | _process (double delta_time) override
| Update the state machine.
void | process_chase (double delta_time)
| Process the chase state. Navigate ahead of player player and drop when near target.
void | process_flee (double delta_time)
| Flee state, Flee away from the player.
void | process_navigate (double delta_time)
| Navigate according to path.
void | recalculate_navigation ()
| Recalculate pathing based on current state.
void | spawn_explosion ()
| Spawn an explosion after dropping.
void | key_found (int total)
| Listener for when a key is found, to up the difficulty.
void | start_flee ()
| Listener for when the player grabs a turret pickup.
void | end_flee ()
| Listener for when the player drop their turret pickup.
void | set_explosion_scene (Ref< PackedScene > scene)
| The explosion to spawn after dropping.
Ref< PackedScene > | get_explosion_scene () const
| The explosion to spawn after dropping.

## Private Member Functions

| GDCLASS (Drone, Node3D)

## Static Private Member Functions

static void | _bind_methods ()
| Register properties.

## Private Attributes

int | recalc_frame_interval {10}
| Time between pathing recalculations.
int | next_recalc {10}
| Frame timer for next pathing recalculation.
float | speed {30.f}
| Movement speed in m/s.
float | lead_time {2.f}
| How far ahead of the player to target.
float | target_distance {3.f}
| distance at which to drop
DroneState | state {DroneState::CHASE}
| Current state machine state.
CarPlayer * | player {nullptr}
| Target to chase / flee from.
Ref< PackedScene > | explosion_scene {}
| Scene to spawn when exploding.
NavigationAgent3D * | agent {nullptr}
| Navigation agent Component.
AnimationPlayer * | anim {nullptr}
| Animation player component.

## Detailed Description

An enemy drone, moves around using navigation. Model is expected to float well above the transform origin.

## Member Function Documentation

## _bind_methods()

void godot::Drone::_bind_methods | ( |  | ) |

staticprivate

Register properties.

## _process()

void godot::Drone::_process | ( | double | delta_time | ) |

overridevirtual

Update the state machine.

## _ready()

void godot::Drone::_ready | ( |  | ) |

overridevirtual

Get required object references and connect observers.

## end_flee()

void godot::Drone::end_flee | ( |  | ) |

Listener for when the player drop their turret pickup.

## GDCLASS()

godot::Drone::GDCLASS | ( | Drone | ,
|  | Node3D |
| ) |  |

private

## get_explosion_scene()

Ref< PackedScene > godot::Drone::get_explosion_scene | ( |  | ) | const

The explosion to spawn after dropping.

## key_found()

void godot::Drone::key_found | ( | int | total | ) |

Listener for when a key is found, to up the difficulty.

## process_chase()

void godot::Drone::process_chase | ( | double | delta_time | ) |

Process the chase state. Navigate ahead of player player and drop when near target.

## process_flee()

void godot::Drone::process_flee | ( | double | delta_time | ) |

Flee state, Flee away from the player.

## process_navigate()

void godot::Drone::process_navigate | ( | double | delta_time | ) |

Navigate according to path.

## recalculate_navigation()

void godot::Drone::recalculate_navigation | ( |  | ) |

Recalculate pathing based on current state.

## set_explosion_scene()

void godot::Drone::set_explosion_scene | ( | Ref< PackedScene > | scene | ) |

The explosion to spawn after dropping.

## spawn_explosion()

void godot::Drone::spawn_explosion | ( |  | ) |

Spawn an explosion after dropping.

## start_flee()

void godot::Drone::start_flee | ( |  | ) |

Listener for when the player grabs a turret pickup.

## Member Data Documentation

## agent

NavigationAgent3D* godot::Drone::agent {nullptr}

private

Navigation agent Component.

## anim

AnimationPlayer* godot::Drone::anim {nullptr}

private

Animation player component.

## explosion_scene

Ref<PackedScene> godot::Drone::explosion_scene {}

private

Scene to spawn when exploding.

## lead_time

float godot::Drone::lead_time {2.f}

private

How far ahead of the player to target.

## next_recalc

int godot::Drone::next_recalc {10}

private

Frame timer for next pathing recalculation.

## player

CarPlayer* godot::Drone::player {nullptr}

private

Target to chase / flee from.

## recalc_frame_interval

int godot::Drone::recalc_frame_interval {10}

private

Time between pathing recalculations.

## speed

float godot::Drone::speed {30.f}

private

Movement speed in m/s.

## state

DroneState godot::Drone::state {DroneState::CHASE}

private

Current state machine state.

## target_distance

float godot::Drone::target_distance {3.f}

private

distance at which to drop

The documentation for this class was generated from the following files:

- src/drone.hpp
- src/drone.cpp