Looking into room collisions we need; set up plastique behavior
This commit is contained in:
@@ -22,36 +22,36 @@ public partial class SetItem : RigidBody3D
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
|
||||
ExplosionArea.AreaEntered += ExplosionArea_AreaEntered;
|
||||
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
||||
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
|
||||
ExplosionArea.AreaEntered += ExplosionArea_AreaEntered;
|
||||
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
||||
}
|
||||
|
||||
private void AnimationTree_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "explode")
|
||||
QueueFree();
|
||||
if (animName == "explode")
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
private void ExplosionArea_AreaEntered(Area3D area)
|
||||
{
|
||||
// if (area is IDoor door) etc
|
||||
// door.Demolish();
|
||||
if (area.GetOwner() is IEnemy enemy)
|
||||
enemy.HealthComponent.Damage(10);
|
||||
if (area.GetOwner() is ExplodableWall wall)
|
||||
// door.Demolish();
|
||||
if (area.GetOwner() is IEnemy enemy)
|
||||
enemy.HealthComponent.Damage(10);
|
||||
}
|
||||
|
||||
public async void Set()
|
||||
{
|
||||
AddCollisionExceptionWith((Node)Player);
|
||||
GlobalPosition = Player.GlobalPosition + Vector3.Up;
|
||||
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized() * 5.0f);
|
||||
await ToSignal(GetTree().CreateTimer(1), "timeout");
|
||||
Explode();
|
||||
AddCollisionExceptionWith((Node)Player);
|
||||
GlobalPosition = Player.GlobalPosition + Vector3.Up;
|
||||
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized() * 5.0f);
|
||||
await ToSignal(GetTree().CreateTimer(1), "timeout");
|
||||
Explode();
|
||||
}
|
||||
|
||||
public void Explode()
|
||||
{
|
||||
_stateMachine.Travel("timer");
|
||||
_stateMachine.Travel("timer");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ anim_player = NodePath("../AnimationPlayer")
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00817871, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 2048
|
||||
collision_mask = 10240
|
||||
|
||||
[node name="Radius" type="MeshInstance3D" parent="ExplosionArea"]
|
||||
transform = Transform3D(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
|
||||
Reference in New Issue
Block a user