2024-01-09 21:45:30 -08:00

34 lines
758 B
Rust

use galactica_galaxy::GxShipHandle;
use rapier2d::dynamics::{RigidBodyHandle, RigidBodySet};
use std::collections::HashMap;
use super::ShipController;
use crate::{
objects::{ShipControls, SySimShip},
StepResources,
};
/// The Null controller is assigned to objects that are static or not controlled by the computer.
/// Most notably, the player's ship has a Null controller.
pub struct Null {}
impl Null {
/// Create a new ship controller
pub fn new() -> Self {
Self {}
}
}
impl ShipController for Null {
fn update_controls(
&mut self,
_res: &StepResources,
_rigid_bodies: &RigidBodySet,
_ships: &HashMap<GxShipHandle, SySimShip>,
_this_ship: RigidBodyHandle,
_this_data: GxShipHandle,
) -> ShipControls {
ShipControls::new()
}
}