Capricorn laser done

This commit is contained in:
2023-09-05 00:30:05 -07:00
parent 5eaa5fc91e
commit c645c56fb8
11 changed files with 147 additions and 20 deletions

View File

@@ -96,11 +96,11 @@ public partial class Capricorn : Character1
private async void Fire()
{
IsShooting = true;
//var projectile = _fireProjectile.Instantiate<Projectile>();
//projectile.Position = Position + new Vector3(0f, 1f, 0f);
//GetParent().AddChild(projectile);
CanShoot = false;
await ToSignal(GetTree().CreateTimer(2.0f), "timeout");
await ToSignal(GetTree().CreateTimer(0.8f), "timeout");
var projectile = _fireProjectile.Instantiate<Projectile>();
projectile.Position = Position + new Vector3(0f, 1f, 0f);
GetParent().AddChild(projectile);
CanShoot = true;
IsShooting = false;
}
@@ -108,11 +108,11 @@ public partial class Capricorn : Character1
private async void AltFire()
{
IsShooting = true;
//var projectile = _altFireProjectile.Instantiate<Projectile>();
//projectile.Position = Position + new Vector3(0f, 1f, 0f);
//GetParent().AddChild(projectile);
CanShoot = false;
await ToSignal(GetTree().CreateTimer(2.0f), "timeout");
await ToSignal(GetTree().CreateTimer(0.8f), "timeout");
var projectile = _altFireProjectile.Instantiate<Projectile>();
projectile.Position = Position + new Vector3(0f, 1f, 0f);
GetParent().AddChild(projectile);
CanShoot = true;
IsShooting = false;
}

View File

@@ -0,0 +1,12 @@
using Godot;
using System.Linq;
public partial class CapricornLaserShot : Projectile
{
public override void _PhysicsProcess(double delta)
{
var shots = GetChildren().OfType<RigidBody3D>();
shots.ElementAt(0).Translate(new Vector3(0, 0, Speed * -(float)delta));
shots.ElementAt(1).Translate(new Vector3(0, 0, Speed * (float)delta));
}
}

View File

@@ -161,8 +161,11 @@ public partial class GameManager : Node
foreach (var player in players)
GetTree().Root.RemoveChild(player);
var main = GetTree().Root.GetNode<Main>("/root/Main");
var projectiles = GetTree().Root.GetChildren().OfType<Projectile>();
foreach (var projectile in projectiles)
GetTree().Root.RemoveChild(projectile);
var main = GetTree().Root.GetNode<Main>("/root/Main");
main.LoadNextLevel(_levelIndex++);
foreach (var player in Players)

View File

@@ -36,6 +36,7 @@ public partial class StageGUI : Control
return;
player.IsSelectingCharacter = true;
ChangeBG(player);
}
public override void _Process(double delta)