Falling rose petal effect

This commit is contained in:
2023-09-13 19:39:10 -07:00
parent 6138957524
commit ce7576731c
16 changed files with 229 additions and 49 deletions

View File

@@ -15,12 +15,17 @@ public partial class Character : CharacterBody3D
public bool CanShoot { get; protected set; }
public bool CanShootAlt { get; protected set; }
protected GameManager _gameManager;
private bool isPaused;
public override void _EnterTree()
{
Position = OwnerPlayer.SpawnPoint.Position;
CanShoot = true;
CanShootAlt = true;
_gameManager = GetTree().Root.GetNode<GameManager>("Main/GameManager");
}
@@ -35,14 +40,14 @@ public partial class Character : CharacterBody3D
MoveAndSlide();
}
public override void _UnhandledInput(InputEvent @event)
public override void _Input(InputEvent @event)
{
if (Input.IsActionJustPressed("exit"))
GetTree().Quit();
if (Input.IsActionJustPressed(OwnerPlayer.PlayerInput.Fire()) && CanShoot)
Fire();
if (Input.IsActionJustPressed(OwnerPlayer.PlayerInput.AltFire()) && CanShoot)
if (Input.IsActionJustPressed(OwnerPlayer.PlayerInput.AltFire()) && CanShootAlt)
AltFire();
}
@@ -94,9 +99,9 @@ public partial class Character : CharacterBody3D
if (proj.HasRotation)
proj.Rotation = GetNode<Node3D>("Pivot").Rotation;
}
CanShoot = false;
CanShootAlt = false;
await ToSignal(GetTree().CreateTimer(projectiles.First().Cooldown), "timeout");
CanShoot = true;
CanShootAlt = true;
}
public void OnHit(Node3D node)

View File

@@ -20,7 +20,7 @@ public partial class CapricornControls : Character
MoveAndSlide();
}
public override void _UnhandledInput(InputEvent @event)
public override void _Input(InputEvent @event)
{
if (Input.IsActionJustPressed("exit"))
GetTree().Quit();
@@ -86,8 +86,8 @@ public partial class CapricornControls : Character
{
IsShooting = true;
CanShoot = false;
await ToSignal(GetTree().CreateTimer(1.0f), "timeout");
var projectile = _fireProjectile.Instantiate<Node3D>();
await ToSignal(GetTree().CreateTimer(1.0f), "timeout");
projectile.Position = Position;
if (GetParent() != null)
GetParent().AddChild(projectile);
@@ -99,8 +99,8 @@ public partial class CapricornControls : Character
{
IsShooting = true;
CanShoot = false;
await ToSignal(GetTree().CreateTimer(1.0f), "timeout");
var projectile = _altFireProjectile.Instantiate<Node3D>();
await ToSignal(GetTree().CreateTimer(1.0f), "timeout");
projectile.Position = Position;
if (GetParent() != null)
GetParent().AddChild(projectile);