diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6098be7..5e1f8f7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -113,7 +113,7 @@ jobs: with: name: binary path: | - ${{ env.PACKAGE_NAME }} + ${{ env.PACKAGE_NAME }}-${{ matrix.target }} # Get itch.io target from env, because the `env` context can't be used in the `if:` condition of a job. # See: https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability @@ -139,8 +139,8 @@ jobs: - name: download all packages uses: actions/download-artifact@v4 with: - pattern: package-* - path: tmp + pattern: "*.zip" + path: "./" - name: install butler run: | diff --git a/Cargo.lock b/Cargo.lock index fa84d33..c25b485 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2797,7 +2797,7 @@ dependencies = [ [[package]] name = "lifecycler" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bevy", "bevy_atmosphere", diff --git a/Cargo.toml b/Cargo.toml index 80ff38b..d9108c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lifecycler" -version = "0.1.1" +version = "0.1.2" edition = "2021" license = "MIT OR Apache-2.0 OR CC0-1.0" diff --git a/src/fish.rs b/src/fish.rs deleted file mode 100644 index 5e019a7..0000000 --- a/src/fish.rs +++ /dev/null @@ -1,275 +0,0 @@ -use std::f32::consts::PI; -use std::time::Duration; - -use bevy::prelude::*; -use bevy::time::common_conditions::on_timer; -use bevy::utils::HashSet; -use rand::seq::SliceRandom; -use rand::{RngCore, SeedableRng}; -use rand_chacha::ChaCha8Rng; - -use crate::pellets::Pellet; - -const FISH_MAX: usize = 5; - -pub(super) fn plugin(app: &mut App) { - app.add_systems(Startup, setup_fish_system).add_systems( - Update, - ( - spawn_fishes_system, - fish_behavior_system, - fish_behavior_change_system, - fish_pellet_detection_system.run_if(on_timer(Duration::from_secs_f32(0.5))), - ), - ); -} - -#[derive(Component)] -pub struct Fish; - -#[derive(Resource, Deref, DerefMut)] -pub struct FishRng(ChaCha8Rng); - -#[derive(Resource, Deref)] -pub struct FishMesh(Handle); - -#[derive(Resource, Deref)] -pub struct FishMaterials(Vec>); - -#[derive(Resource, Deref, DerefMut)] -pub struct FishTimer(Timer); - -pub enum FishBehaviorVariant { - Idle, - SwimRight, - SwimLeft, - SeekPoint(Vec3), - SeekPellet(Entity), -} - -#[derive(Component)] -pub struct FishBehavior { - timer: Timer, - variant: FishBehaviorVariant, -} - -impl Default for FishBehavior { - fn default() -> Self { - Self { - timer: Timer::from_seconds(5., TimerMode::Repeating), - variant: FishBehaviorVariant::Idle, - } - } -} - -fn setup_fish_system( - mut commands: Commands, - asset_server: Res, - mut materials: ResMut>, -) { - let fish_mesh = asset_server.load( - (GltfAssetLabel::Primitive { - mesh: 0, - primitive: 0, - }) - .from_asset("fish.glb"), - ); - commands.insert_resource(FishMesh(fish_mesh)); - - let mut seeded_rng = ChaCha8Rng::seed_from_u64(19878367467712); - let fish_materials = (0..36) - .map(|_| { - let base_color = Color::hsl((seeded_rng.next_u32() % 360) as f32, 0.4, 0.3); - let emissive = base_color.to_linear() * 0.1; - - materials.add(StandardMaterial { - base_color, - emissive, - ..default() - }) - }) - .collect(); - commands.insert_resource(FishMaterials(fish_materials)); - commands.insert_resource(FishRng(seeded_rng)); - - let fish_timer = Timer::from_seconds(0.5, TimerMode::Repeating); - commands.insert_resource(FishTimer(fish_timer)); -} - -fn spawn_fishes_system( - mut commands: Commands, - time: Res