Compare commits
2 commits
283b86d04a
...
e2d0d553e9
| Author | SHA1 | Date | |
|---|---|---|---|
| e2d0d553e9 | |||
| 2d4dc3c708 |
9 changed files with 87 additions and 7 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -1655,8 +1655,10 @@ dependencies = [
|
||||||
"bevy",
|
"bevy",
|
||||||
"building",
|
"building",
|
||||||
"combat",
|
"combat",
|
||||||
|
"resources",
|
||||||
"state",
|
"state",
|
||||||
"ui_range_indicator",
|
"ui_range_indicator",
|
||||||
|
"upgrade",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,8 @@ fn register(
|
||||||
});
|
});
|
||||||
|
|
||||||
let info = commands.spawn_empty().id();
|
let info = commands.spawn_empty().id();
|
||||||
let test_unlocks = vec![
|
let test_unlocks =
|
||||||
|
vec![
|
||||||
commands
|
commands
|
||||||
.spawn((
|
.spawn((
|
||||||
Name::new("ROCKET BARRAGE"),
|
Name::new("ROCKET BARRAGE"),
|
||||||
|
|
@ -69,7 +70,7 @@ fn register(
|
||||||
description: "bangbangbangbangbangbangbangbang".to_string(),
|
description: "bangbangbangbangbangbangbangbang".to_string(),
|
||||||
cost: Quantity {
|
cost: Quantity {
|
||||||
souls: 10,
|
souls: 10,
|
||||||
bones: 10,
|
bones: 20,
|
||||||
},
|
},
|
||||||
unlocks: vec![],
|
unlocks: vec![],
|
||||||
},
|
},
|
||||||
|
|
@ -88,7 +89,7 @@ fn register(
|
||||||
Name::new("Party Mode"),
|
Name::new("Party Mode"),
|
||||||
Upgrade {
|
Upgrade {
|
||||||
description: "I'm in the house tonight.".to_string(),
|
description: "I'm in the house tonight.".to_string(),
|
||||||
cost: Quantity { souls: 0, bones: 0 },
|
cost: Quantity { souls: 20, bones: 10 },
|
||||||
unlocks: vec![],
|
unlocks: vec![],
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ bevy = { workspace = true }
|
||||||
combat = { path = "../combat" }
|
combat = { path = "../combat" }
|
||||||
building = { path = "../building" }
|
building = { path = "../building" }
|
||||||
state = { path = "../state" }
|
state = { path = "../state" }
|
||||||
|
resources = { path = "../resources" }
|
||||||
ui_range_indicator = { path = "../ui_range_indicator" }
|
ui_range_indicator = { path = "../ui_range_indicator" }
|
||||||
|
upgrade = { path = "../upgrade" }
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,10 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use building::{BuildingInfo, BuildingPreview, Core, PREVIEW_ALPHA, PopulatePlacedBuilding};
|
use building::{BuildingInfo, BuildingPreview, Core, PREVIEW_ALPHA, PopulatePlacedBuilding};
|
||||||
use combat::{Defense, Died, Health, Range};
|
use combat::{Defense, Died, Health, Range};
|
||||||
|
use resources::{AvailableWorkers, Quantity};
|
||||||
use state::{CoreState, GameState};
|
use state::{CoreState, GameState};
|
||||||
use ui_range_indicator::CustomRangeIndicator;
|
use ui_range_indicator::CustomRangeIndicator;
|
||||||
|
use upgrade::{Upgrade, UpgradeApplied, UpgradeTree};
|
||||||
|
|
||||||
pub struct BuildingCorePlugin;
|
pub struct BuildingCorePlugin;
|
||||||
|
|
||||||
|
|
@ -57,16 +59,18 @@ fn register(
|
||||||
CorePreview,
|
CorePreview,
|
||||||
))
|
))
|
||||||
.id();
|
.id();
|
||||||
|
let upgrades = get_upgrades(&mut commands);
|
||||||
commands.entity(info).insert((
|
commands.entity(info).insert((
|
||||||
BuildingInfo {
|
BuildingInfo {
|
||||||
preview,
|
preview,
|
||||||
size: SIZE,
|
size: SIZE,
|
||||||
unlocked: false,
|
unlocked: false,
|
||||||
},
|
},
|
||||||
|
UpgradeTree { upgrades },
|
||||||
Name::new("Core"),
|
Name::new("Core"),
|
||||||
Health::new(100.0),
|
Health::new(100.0),
|
||||||
Defense::new(5.0),
|
Defense::new(5.0),
|
||||||
Range(25.0),
|
Range(15.0),
|
||||||
));
|
));
|
||||||
commands.insert_resource(CoreResources {
|
commands.insert_resource(CoreResources {
|
||||||
mesh: mesh,
|
mesh: mesh,
|
||||||
|
|
@ -75,6 +79,54 @@ fn register(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_upgrades(commands: &mut Commands) -> Vec<Entity> {
|
||||||
|
fn create_worker_upgrade(
|
||||||
|
commands: &mut Commands,
|
||||||
|
name: String,
|
||||||
|
desc: &'static str,
|
||||||
|
cost: Quantity,
|
||||||
|
unlocks: Vec<Entity>,
|
||||||
|
) -> Entity {
|
||||||
|
commands
|
||||||
|
.spawn((
|
||||||
|
Name::new(name),
|
||||||
|
Upgrade {
|
||||||
|
description: desc.to_string(),
|
||||||
|
cost,
|
||||||
|
unlocks,
|
||||||
|
},
|
||||||
|
))
|
||||||
|
.observe(
|
||||||
|
|_trigger: Trigger<UpgradeApplied>,
|
||||||
|
mut workers: ResMut<AvailableWorkers>,
|
||||||
|
mut range: Single<&mut Range, With<Core>>| {
|
||||||
|
workers.0 += 1;
|
||||||
|
range.0 += 5.0;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.id()
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut worker_upgrade = None;
|
||||||
|
for i in (1..=5).rev() {
|
||||||
|
let unlocks = if let Some(up) = worker_upgrade {
|
||||||
|
vec![up]
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
};
|
||||||
|
worker_upgrade = Some(create_worker_upgrade(
|
||||||
|
commands,
|
||||||
|
format!("Create Worker {}", i),
|
||||||
|
"Forms a new worker, useful for harvesting resource deposits. Increases the Core's domain.",
|
||||||
|
Quantity {
|
||||||
|
souls: 25 * 2_u32.pow(i - 1),
|
||||||
|
bones: 20 * 2_u32.pow(i - 1),
|
||||||
|
},
|
||||||
|
unlocks,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
vec![worker_upgrade.unwrap()]
|
||||||
|
}
|
||||||
fn populate(
|
fn populate(
|
||||||
trigger: Trigger<PopulatePlacedBuilding>,
|
trigger: Trigger<PopulatePlacedBuilding>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use avian3d::prelude::*;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use physics::PhysicsLayers;
|
use physics::PhysicsLayers;
|
||||||
use resources::{Drops, Resources};
|
use resources::{Drops, Resources};
|
||||||
use state::{BasePhaseState, GameSystemSet};
|
use state::GameSystemSet;
|
||||||
|
|
||||||
pub struct CombatPlugin;
|
pub struct CombatPlugin;
|
||||||
|
|
||||||
|
|
@ -212,7 +212,6 @@ fn on_die(
|
||||||
trigger: Trigger<Died>,
|
trigger: Trigger<Died>,
|
||||||
names: Query<&Name>,
|
names: Query<&Name>,
|
||||||
drops: Query<&Drops>,
|
drops: Query<&Drops>,
|
||||||
phase: Res<State<BasePhaseState>>,
|
|
||||||
mut resources: ResMut<Resources>,
|
mut resources: ResMut<Resources>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ fn spawn(
|
||||||
bounty: Quantity { souls: 0, bones: 5 },
|
bounty: Quantity { souls: 0, bones: 5 },
|
||||||
level: 0,
|
level: 0,
|
||||||
harvest_time: Duration::from_secs(5),
|
harvest_time: Duration::from_secs(5),
|
||||||
|
max_workers: 2,
|
||||||
},
|
},
|
||||||
Mesh3d(res.mesh.clone()),
|
Mesh3d(res.mesh.clone()),
|
||||||
MeshMaterial3d(res.material.clone()),
|
MeshMaterial3d(res.material.clone()),
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ impl Plugin for ResourcesPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(OnEnter(AppState::Game), setup)
|
app.add_systems(OnEnter(AppState::Game), setup)
|
||||||
.add_systems(FixedUpdate, tick_harvest.in_set(GameSystemSet::Execute))
|
.add_systems(FixedUpdate, tick_harvest.in_set(GameSystemSet::Execute))
|
||||||
.insert_resource(AvailableWorkers(5))
|
.insert_resource(AvailableWorkers(1))
|
||||||
.add_observer(on_harvest);
|
.add_observer(on_harvest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -124,6 +124,7 @@ pub struct ResourceDeposit {
|
||||||
pub bounty: Quantity,
|
pub bounty: Quantity,
|
||||||
pub level: u32,
|
pub level: u32,
|
||||||
pub harvest_time: Duration,
|
pub harvest_time: Duration,
|
||||||
|
pub max_workers: u32,
|
||||||
// todo - add finite resources and refresh timer
|
// todo - add finite resources and refresh timer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,10 @@ fn side_panel(
|
||||||
ui.add_enabled(false, egui::Button::new("Out of Core's range"));
|
ui.add_enabled(false, egui::Button::new("Out of Core's range"));
|
||||||
} else if available_workers.0 == 0 {
|
} else if available_workers.0 == 0 {
|
||||||
ui.add_enabled(false, egui::Button::new("No workers available"));
|
ui.add_enabled(false, egui::Button::new("No workers available"));
|
||||||
|
} else if let Some(ref worked) = opt_worked
|
||||||
|
&& worked.workers >= deposit.max_workers
|
||||||
|
{
|
||||||
|
ui.add_enabled(false, egui::Button::new("Maximum workers reached"));
|
||||||
} else {
|
} else {
|
||||||
if ui.button("Add worker").clicked() {
|
if ui.button("Add worker").clicked() {
|
||||||
available_workers.0 = available_workers.0.saturating_sub(1);
|
available_workers.0 = available_workers.0.saturating_sub(1);
|
||||||
|
|
|
||||||
18
todo.txt
Normal file
18
todo.txt
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
--- VERY IMPORTANT ---
|
||||||
|
- sound
|
||||||
|
- music
|
||||||
|
x limit workers per resource deposit
|
||||||
|
- main menu
|
||||||
|
- improve enemy AI
|
||||||
|
- balance
|
||||||
|
|
||||||
|
--- IMPORTANT ---
|
||||||
|
- More towers
|
||||||
|
- More upgrades
|
||||||
|
- More enemy types
|
||||||
|
- More resource deposit types
|
||||||
|
|
||||||
|
--- STILL PRETTY IMPORTANT ---
|
||||||
|
- Building repair
|
||||||
|
x core upgrade (yeah I'm just adding more workers and range)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue