generated from 2ndbeam/bevy-template
feat: lighting system
- Added lamp bundle - Moved door collider to its children - Updated level structure
This commit is contained in:
parent
3cddecf592
commit
08751ff12f
12 changed files with 134 additions and 31 deletions
|
|
@ -176,6 +176,31 @@ impl From<ContainerDataInner> for ContainerData {
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn default_intensity() -> f32 { 2. }
|
||||
|
||||
pub(super) fn default_radius() -> f32 { 4. }
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone, Reflect)]
|
||||
#[reflect(Debug, Default, Deserialize, Serialize, PartialEq, Clone)]
|
||||
pub(super) struct LampDataInner {
|
||||
#[serde(flatten)]
|
||||
pub pos: Pos,
|
||||
#[serde(default = "default_intensity")]
|
||||
pub intensity: f32,
|
||||
#[serde(default = "default_radius")]
|
||||
pub radius: f32,
|
||||
}
|
||||
|
||||
impl From<LampDataInner> for LampData {
|
||||
fn from(LampDataInner { pos, intensity, radius }: LampDataInner) -> Self {
|
||||
Self {
|
||||
pos: pos.into(),
|
||||
intensity,
|
||||
radius,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone, Reflect)]
|
||||
#[reflect(Debug, Default, Deserialize, Serialize, PartialEq, Clone)]
|
||||
pub(super) struct InteractiveInner {
|
||||
|
|
@ -186,15 +211,18 @@ pub(super) struct InteractiveInner {
|
|||
pub stairs: Option<Vec<StairsData>>,
|
||||
#[serde(default)]
|
||||
pub containers: Option<Vec<ContainerData>>,
|
||||
#[serde(default)]
|
||||
pub lamps: Option<Vec<LampData>>,
|
||||
}
|
||||
|
||||
impl From<InteractiveInner> for Interactive {
|
||||
fn from(InteractiveInner { player, doors, stairs, containers }: InteractiveInner) -> Self {
|
||||
fn from(InteractiveInner { player, doors, stairs, containers, lamps }: InteractiveInner) -> Self {
|
||||
Self {
|
||||
player: player.into(),
|
||||
doors: doors.unwrap_or_default(),
|
||||
stairs: stairs.unwrap_or_default(),
|
||||
containers: containers.unwrap_or_default(),
|
||||
lamps: lamps.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue