2024-01-09 20:51:28 -08:00

35 lines
764 B
Rust

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