Attempt to fix double goals
This commit is contained in:
parent
f8422a9d53
commit
05584b9d28
@ -38,7 +38,10 @@ impl IArea3D for Goal {
|
|||||||
|
|
||||||
impl Goal {
|
impl Goal {
|
||||||
fn on_enter(&self, node: Gd<Node3D>) {
|
fn on_enter(&self, node: Gd<Node3D>) {
|
||||||
if let Ok(_) = node.try_cast::<Ball>() {
|
if let Ok(mut ball) = node.try_cast::<Ball>()
|
||||||
|
&& !ball.bind().entered_goal
|
||||||
|
{
|
||||||
|
ball.bind_mut().entered_goal = true;
|
||||||
if let Some(mut game) = Game::singleton() {
|
if let Some(mut game) = Game::singleton() {
|
||||||
let teams = game
|
let teams = game
|
||||||
.bind()
|
.bind()
|
||||||
|
|||||||
@ -12,6 +12,7 @@ use crate::{
|
|||||||
#[class(base=RigidBody3D, init)]
|
#[class(base=RigidBody3D, init)]
|
||||||
pub struct Ball {
|
pub struct Ball {
|
||||||
pub dropper: Option<u16>,
|
pub dropper: Option<u16>,
|
||||||
|
pub entered_goal: bool,
|
||||||
|
|
||||||
alive_for: f64,
|
alive_for: f64,
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user