use crate::state::State;
use serde::{Deserialize, Serialize};
#[derive(crate::Resource, Clone, Debug, Serialize, Deserialize)]
pub struct DungeonConfig {
pub total_floors: u32,
pub rooms_per_floor: u32,
pub connection_pattern: ConnectionPattern,
}
impl Default for DungeonConfig {
fn default() -> Self {
Self {
total_floors: 5,
rooms_per_floor: 3,
connection_pattern: ConnectionPattern::Linear,
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum ConnectionPattern {
Linear,
Branching,
Graph,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct DungeonState {
pub current_floor: u32,
pub current_room: u32,
pub visited_rooms: Vec<RoomId>,
pub unlocked_connections: Vec<Connection>,
}
impl State for DungeonState {}
impl Default for DungeonState {
fn default() -> Self {
Self {
current_floor: 1,
current_room: 1,
visited_rooms: vec![RoomId { floor: 1, room: 1 }],
unlocked_connections: vec![],
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct RoomId {
pub floor: u32,
pub room: u32,
}
impl RoomId {
pub fn new(floor: u32, room: u32) -> Self {
Self { floor, room }
}
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Connection {
pub from: RoomId,
pub to: RoomId,
}
impl Connection {
pub fn new(from: RoomId, to: RoomId) -> Self {
Self { from, to }
}
}