Color filter
This commit is contained in:
parent
b42a032cfd
commit
2a4625269f
4 changed files with 112 additions and 75 deletions
133
Cargo.lock
generated
133
Cargo.lock
generated
|
@ -208,9 +208,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
|||
|
||||
[[package]]
|
||||
name = "bevy"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55f08528a4e59d607460513a823b40f602d013c1a00f57b824f1075d5d48c3cd"
|
||||
checksum = "fea147ef1ebb92d41294cfad804c40de151b174c711ce6e0a4a40eba23eae1a4"
|
||||
dependencies = [
|
||||
"bevy_internal",
|
||||
]
|
||||
|
@ -241,9 +241,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_animation"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e243169af495ad616ff701247c0d3e40078a26ed8de231cf9e54bde6b3c4bb45"
|
||||
checksum = "a4365465fca7bd78295eb81d0a04afc049399852793d562eb017849bb5d6c55e"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -259,9 +259,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_app"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d26d6ffdf493609d2fedc1018a2ef0cb4d8e48f6d3bcea56fa2df81867e464"
|
||||
checksum = "9e4ae0a6ed2adf3b153511b4645241660a93f747c05ecd1e5a909dafc803cad4"
|
||||
dependencies = [
|
||||
"bevy_derive",
|
||||
"bevy_ecs",
|
||||
|
@ -274,9 +274,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_asset"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d8fb95306d5f18fa70df40632cd984993aeb71e91ce059ae99699098a4f9ce9"
|
||||
checksum = "2ec773c861a7e9d9978771f59f385500ec6da3a1ab5487705cddb054393d3d19"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -302,9 +302,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_audio"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eee08ac575397ce17477dd291862bafa15226334bdfb82c02bbc3d10bad7bdb8"
|
||||
checksum = "1e5cf4713a24f318841f73a9e030854cfd5bad46bc81fa1acc9590cdab053c6f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -318,9 +318,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_core"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6712146d54fff9e1865362e9f39a7b63c7b037ddb72a3d7bb05b959213fb61e"
|
||||
checksum = "c53172003d5cde7780870b5403c66c8ede3581faf3e510e916d8b4baa5b538d2"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -333,9 +333,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_core_pipeline"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "080bb00399b6d7697e505f871d67c6de8b52eb06b47b0cda2be80c2396805983"
|
||||
checksum = "5e60efd10d593f6d122f2687f74c09ad55835a8f999c35bed6380ddd8e6ff7f2"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -351,9 +351,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_derive"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4b8f0786d1fc7e0d35297917be463db3d0886f7bd8d4221ca3d565502579ffb"
|
||||
checksum = "0e6345431bbe6d7b6c165cd860ecd0b35da929779571259c5df970ac256d45f9"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"quote",
|
||||
|
@ -362,9 +362,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_diagnostic"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adab74ee5375fbf5d2b1d3da41de8d1491a8a706d17441b5e31214b65349d692"
|
||||
checksum = "58ac9f4c2815f412be4b6e21e4b299cdafa710f651d064f6d40b2a8377a0d17c"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -375,9 +375,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_ecs"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5643dc27b7d6778e3a66c8e0f6ad1fd33309aa2fa61d935f360ccc85b7be6a2"
|
||||
checksum = "c174066a24ed8a14d15ea58b0aea1c1f5c763f4bb36ebdc2b1dc78026007d0f5"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"bevy_ecs_macros",
|
||||
|
@ -394,9 +394,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_ecs_macros"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5f2f12677f8725d40930d0a19652f007fe0ef5ac38e23817cfc4930c61f5680"
|
||||
checksum = "cc50c39e49e8febccc74e8e731680adb0cb4aef1f53275740cbaa95c6da71f4f"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -419,9 +419,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_encase_derive"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76a767adc36ce1fc917a736843b026d4de7069d90ed5e669c852481ef69fd5aa"
|
||||
checksum = "68bc194009c5e9b97da64a08142dd183c264885d99c985cf849868103018adf1"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"encase_derive_impl",
|
||||
|
@ -429,9 +429,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_gilrs"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "963940426127533164af2a556971a03c493143c0afb95afadb4a070b6ab8c3df"
|
||||
checksum = "cb15a3427d9707be92b457e5d66900b02d853b475c21dd8662bdda387ba9f24e"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -442,9 +442,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_gltf"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "150cc6782c4472600c2ade5d78c6ce481c992690f0499e63765aba752d7e0f04"
|
||||
checksum = "79db7d7e71b47a69953fbe8407ded5c6308eaeecf9a05efd5dfb42992f400a16"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
@ -471,9 +471,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_hierarchy"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2e4c20d7c843cd26ef3c5d7b4c20e3e32c275943e2437ecaca1cfd6cfe3b30"
|
||||
checksum = "5eb1ec76099ea5a716de08ea42ff41f036ebe2502df1d569168b58f16458a85e"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -484,9 +484,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_input"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a11c70573fb4d4c056ba32cfa553daa7e6e1245cb876ccfbe322640928b7ee1c"
|
||||
checksum = "1821c4b760ba6ddb4fe61806e9cc33f40b09a884557aca4553a29b8c7d73c6b4"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -496,9 +496,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_internal"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d603b597772130782eab6e604706cbb764fb037f9cf0a1904b6f342845b6f44"
|
||||
checksum = "ee63ad1e3f95a26ff2c227fadb1534a7bfe3a098e0e45c347f2f2575a573d9bc"
|
||||
dependencies = [
|
||||
"bevy_animation",
|
||||
"bevy_app",
|
||||
|
@ -534,9 +534,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_log"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cafb12fc84734236e36f407ab62c72d5d4279fa4777e40a95d7cc973cbabcd1"
|
||||
checksum = "092daf498887814a064331dfcd1cf487a5ddab01fd38629b84a35b8b664462a1"
|
||||
dependencies = [
|
||||
"android_log-sys",
|
||||
"bevy_app",
|
||||
|
@ -549,9 +549,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_macro_utils"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d081af83b701e16cad209255ba6b383744dfa49efa99eb6505989f293305ab3"
|
||||
checksum = "43fb5137e5198302d7c6c33d1e454cf48a586e7c6fd12f4860f12863951e16b9"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
|
@ -560,18 +560,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_math"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db5394e86c5708d3aa506c6e98ec4ed2a4083a7a018c6693d9ac0e77ebfabfc2"
|
||||
checksum = "531f2b90c7e861a96f418b3d560131b3354c5e67a67eba3953a45a56ea0114d2"
|
||||
dependencies = [
|
||||
"glam",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_mikktspace"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40b299a61175a6f7e7398f83cd5b50920fd8bad4df674e614ad94f25f8426509"
|
||||
checksum = "941e7d3d4e1dbb735f040e4cdc1558be1d3c38d43f1d9fdbb039c39a7849a00b"
|
||||
dependencies = [
|
||||
"glam",
|
||||
]
|
||||
|
@ -599,9 +599,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_ptr"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d92d5679e89602a18682a37846573dcd1979410179e14204280460ba9fb8713a"
|
||||
checksum = "9960c19e582b43cebe1894b6679520a4f50802d1cc5b6fa432f8d685ed232f09"
|
||||
|
||||
[[package]]
|
||||
name = "bevy_rapier2d"
|
||||
|
@ -618,9 +618,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_reflect"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08798e67f2d4e6898ef117d8c99cf3b50a8eebc8da4159e6dad2657a0fbe9a4e"
|
||||
checksum = "3fc689dd7a7df3b3768884a4754711d406aa302ea48da483c03b52715fa95045"
|
||||
dependencies = [
|
||||
"bevy_ptr",
|
||||
"bevy_reflect_derive",
|
||||
|
@ -637,9 +637,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_reflect_derive"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19209a7f0238053802b7de04e6724bd90d4ed7d90e87101dbd1b64cca64ff694"
|
||||
checksum = "8c36fa5100832c787c10558d31632ddc454c221e8dfacbbef836938f59614754"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -650,9 +650,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_render"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb49530388ef17cff3fb8bd5e47372fb3cfeb4befc73e3036f6462ac20f049ef"
|
||||
checksum = "600bcef85c7efac6e38ed725707f0e5b7c59b510430034ba2f743f472493f845"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -693,9 +693,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_render_macros"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7d0b7a51fa819c20c64f43856c5aaea40f853050bbb09b9ba3672e5ff2688a5"
|
||||
checksum = "1be90adc9e5d5808833e363670818da5fe68ccafd7ca983a457f90957d2a430b"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -705,9 +705,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_scene"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0064d73ebb0de39901478b493604a1a6d448fd337b66803004c60f41f1fa6c37"
|
||||
checksum = "a045d575d2c8f776d8ea965363c81660243fefbfc3712ead938b00dfd6797216"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -753,9 +753,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_tasks"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff874c91a36eaac3ef957c6f3b590fb71332d9d136671cc858847d56fe9f80a3"
|
||||
checksum = "719b753acb3d5b9dbfd77038560fe1893c17d4ee0a4242c2ee70da9d59430537"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-executor",
|
||||
|
@ -768,9 +768,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_text"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef05a788c2c04aaa5db95b22a8f0fff0d3a0b08a7bcd1a71f050a628b38eec6e"
|
||||
checksum = "c265b7515faf55a3b92fd6ce0ab65dd246f247e11d737d6f5cdaf49c2be42c63"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"anyhow",
|
||||
|
@ -791,9 +791,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_time"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74ec681d641371df81d7bfbcb0eea725ed873f38a094f34b5f7b436f0889e77c"
|
||||
checksum = "22830665b8476292b861216383fd79922aef2b540f9fd09d49144e3e5e94550e"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -804,9 +804,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_transform"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42e1528e35f30bede46a50ee4134f150efc01f5c1002c340b3b2e6a0bfcb8aa5"
|
||||
checksum = "a4bb8760f03e9667e7499a5ceec1f7630fc3e45702781ac0df56cb969e8ae668"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -845,9 +845,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_utils"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bda6dada53e546845887ae7357eec57b8d547ef71627b716b33839b4a98b687"
|
||||
checksum = "f6e9aa1866c1cf7ee000f281ce9e90d02d701f5c7380a107252017e58e2f5246"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"getrandom",
|
||||
|
@ -874,9 +874,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_winit"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57537a56ac4f4e1ffcad95227bcab37cd17b51770dacff82374a2d88be376322"
|
||||
checksum = "98b15fee4b75472e3441b0c7221467303e4ce59b342a94a328e447e7cdb5a43c"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"bevy_app",
|
||||
|
@ -904,6 +904,7 @@ dependencies = [
|
|||
"hexodsp",
|
||||
"rand",
|
||||
"rand_distr",
|
||||
"rapier2d",
|
||||
"ticktock",
|
||||
]
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@ license = "AGPL-3.0-only"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.8.0"
|
||||
bevy = "0.8.1"
|
||||
bevy-inspector-egui = "0.12.1"
|
||||
bevy_rapier2d = "0.16.2"
|
||||
crossbeam-channel = "0.5.6"
|
||||
rand = "0.8.5"
|
||||
rand_distr = "0.4.3"
|
||||
rapier2d = "0.14.0"
|
||||
|
||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies]
|
||||
cpal = "0.14.0"
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
## TODO
|
||||
|
||||
* name
|
||||
* color filters
|
||||
* more filters
|
||||
* despawn black characters
|
||||
* despawn character when too far
|
||||
* level design
|
||||
* (?) can jump only from a surface (no mid-air jump)
|
||||
* (?) multiplayer
|
||||
|
|
47
src/game.rs
47
src/game.rs
|
@ -12,6 +12,7 @@ use bevy::{
|
|||
sprite::Mesh2dHandle,
|
||||
};
|
||||
use bevy_rapier2d::prelude::*;
|
||||
use rapier2d::geometry::CollisionEventFlags;
|
||||
|
||||
pub enum AudioMsg {
|
||||
Color([f32; 3]),
|
||||
|
@ -154,7 +155,6 @@ pub fn spawn_character(
|
|||
.insert(CharacterColor(color))
|
||||
.insert(RigidBody::Dynamic)
|
||||
.insert(Collider::cuboid(32., 32.))
|
||||
.insert(ExternalForce::default())
|
||||
.insert(Velocity::default())
|
||||
.insert(GravityScale(10.0))
|
||||
.insert(LockedAxes::ROTATION_LOCKED)
|
||||
|
@ -163,7 +163,6 @@ pub fn spawn_character(
|
|||
linear_damping: 0.5,
|
||||
angular_damping: 0.5,
|
||||
})
|
||||
.insert(ExternalImpulse::default())
|
||||
.insert(ActiveEvents::COLLISION_EVENTS);
|
||||
|
||||
if is_player {
|
||||
|
@ -179,7 +178,13 @@ fn collision_event_system(
|
|||
character_meshes: Res<CharacterMeshes>,
|
||||
mut materials: ResMut<Assets<ColorMaterial>>,
|
||||
mut collision_events: EventReader<CollisionEvent>,
|
||||
character_query: Query<(&CharacterColor, &Transform, Option<&Player>)>,
|
||||
mut character_query: Query<(
|
||||
&mut CharacterColor,
|
||||
&Transform,
|
||||
&mut Handle<ColorMaterial>,
|
||||
Option<&Player>,
|
||||
)>,
|
||||
pass_through_filter_query: Query<(&PassThroughFilter, &FilterColor)>,
|
||||
mut app_state: ResMut<State<AppState>>,
|
||||
audio: Res<crossbeam_channel::Sender<AudioMsg>>,
|
||||
) {
|
||||
|
@ -187,8 +192,8 @@ fn collision_event_system(
|
|||
if let CollisionEvent::Started(e1, e2, flags) = collision_event {
|
||||
if flags.is_empty() {
|
||||
if let (
|
||||
Ok((c1_color, c1_transform, c1_player)),
|
||||
Ok((c2_color, c2_transform, c2_player)),
|
||||
Ok((c1_color, c1_transform, _c1_material, c1_player)),
|
||||
Ok((c2_color, c2_transform, _c2_material, c2_player)),
|
||||
) = (character_query.get(*e1), character_query.get(*e2))
|
||||
{
|
||||
commands.entity(*e1).despawn_recursive();
|
||||
|
@ -225,6 +230,34 @@ fn collision_event_system(
|
|||
|
||||
audio.send(AudioMsg::Fusion).ok();
|
||||
}
|
||||
} else if *flags == CollisionEventFlags::SENSOR {
|
||||
if let (
|
||||
Ok((mut c_color, _c_transform, mut c_material, c_player)),
|
||||
Ok((filter, filter_color)),
|
||||
) = (
|
||||
character_query.get_mut(*e1),
|
||||
pass_through_filter_query.get(*e2),
|
||||
) {
|
||||
c_color.0 = match filter {
|
||||
PassThroughFilter::Absorbing => Vec4::from(c_color.0)
|
||||
.mul_add(
|
||||
-Vec4::from(filter_color.0) * Vec4::from([1., 1., 1., 0.]),
|
||||
Vec4::from(c_color.0),
|
||||
)
|
||||
.into(),
|
||||
};
|
||||
*c_material = materials.add(ColorMaterial::from(c_color.0));
|
||||
|
||||
if c_player.is_some() {
|
||||
audio
|
||||
.send(AudioMsg::Color([
|
||||
c_color.0.r(),
|
||||
c_color.0.g(),
|
||||
c_color.0.b(),
|
||||
]))
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,10 +333,10 @@ fn player_movement_system(
|
|||
}
|
||||
|
||||
fn character_particle_effect_system(
|
||||
characters: Query<(&Transform, &CharacterColor), With<Player>>,
|
||||
player_character: Query<(&Transform, &CharacterColor), With<Player>>,
|
||||
mut particle_effect: ResMut<crate::particle_effect::ParticleEffectResource>,
|
||||
) {
|
||||
for (transform, color) in characters.iter() {
|
||||
if let Ok((transform, color)) = player_character.get_single() {
|
||||
particle_effect.translation = transform.translation;
|
||||
particle_effect.color = color.0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue