bugs attack
This commit is contained in:
parent
062daf6743
commit
1f03c20237
Binary file not shown.
|
|
@ -187,10 +187,10 @@ impl Enemy {
|
|||
if !self.fight {
|
||||
return;
|
||||
}
|
||||
let index = ctx.scene.graph.try_get_script_index_of::<Player>(self.player_handle).unwrap();
|
||||
match ctx
|
||||
.scene
|
||||
.graph
|
||||
.try_get_script_of_mut::<Player>(self.player_handle)
|
||||
.scene
|
||||
.graph.try_get_mut(self.player_handle).and_then(|node| node.try_get_script_mut::<Player>(index))
|
||||
{
|
||||
Some(script) => {
|
||||
if script.get_health() <= 0.0 {
|
||||
|
|
|
|||
|
|
@ -358,10 +358,11 @@ impl Player {
|
|||
parent = Some(d.parent());
|
||||
}
|
||||
if let Some(d) = parent {
|
||||
let index = context.scene.graph.try_get_script_index_of::<Enemy>(d).unwrap();
|
||||
match context
|
||||
.scene
|
||||
.graph
|
||||
.try_get_script_of_mut::<Enemy>(d)
|
||||
.try_get_mut(d).and_then(|node| node.try_get_script_mut::<Enemy>(index))
|
||||
{
|
||||
Some(script) => {
|
||||
script.take_damage(&self.damage);
|
||||
|
|
|
|||
Loading…
Reference in New Issue