Sun scoring and zombie hat impulse
This commit is contained in:
parent
0e5dee50f7
commit
6608fb8389
9 changed files with 62 additions and 7 deletions
|
|
@ -1,12 +1,16 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
using Newlon.Components.Zombies;
|
||||
using System;
|
||||
|
||||
public partial class FallParticle : RigidBody2D
|
||||
{
|
||||
[Export] private RuntimeZombieData data;
|
||||
[Export] private Timer deathTimer;
|
||||
[Export] private Vector2 falloffImpulseMin = Vector2.Zero;
|
||||
[Export] private Vector2 falloffImpulseMax = Vector2.Zero;
|
||||
[Export] private Vector2 falloffOffsetMin = Vector2.Zero;
|
||||
[Export] private Vector2 falloffOffsetMax = Vector2.Zero;
|
||||
[Export] private float Impulse;
|
||||
public void FallOff()
|
||||
{
|
||||
SetDeferred("freeze", false);
|
||||
|
|
@ -14,7 +18,17 @@ public partial class FallParticle : RigidBody2D
|
|||
{
|
||||
AddCollisionExceptionWith(floor);
|
||||
}
|
||||
Callable.From(()=>{ Reparent(PoolContainer.Instance.Zombies); }).CallDeferred();
|
||||
Callable.From(() =>
|
||||
{
|
||||
Reparent(PoolContainer.Instance.Zombies);
|
||||
ApplyImpulse(RandomVector(falloffImpulseMin, falloffImpulseMax).Normalized() * Impulse, RandomVector(falloffOffsetMin, falloffOffsetMax));
|
||||
}).CallDeferred();
|
||||
|
||||
deathTimer.Start();
|
||||
}
|
||||
|
||||
private Vector2 RandomVector(Vector2 min, Vector2 max)
|
||||
{
|
||||
return new Vector2((float)GD.RandRange(min.X,max.X),(float)GD.RandRange(min.Y,max.Y));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue