Trying to fix spawn issues

This commit is contained in:
2023-09-04 17:22:02 -07:00
parent ad48e723d5
commit 316651f409
17 changed files with 88 additions and 148 deletions

View File

@@ -1,5 +1,6 @@
using Godot;
using System.Linq;
using static Godot.Projection;
public partial class StageGUI : Control
{
@@ -37,41 +38,39 @@ public partial class StageGUI : Control
public override void _Process(double delta)
{
var playersCurrentlySelecting = _gameManager.Players.Where(x => x.IsSelectingCharacter);
foreach (var player in playersCurrentlySelecting)
if (_gameManager.Players.ElementAt(0).IsSelectingCharacter)
{
if (player == _gameManager.Players.ElementAt(0))
{
if (Input.IsActionJustPressed("p1_right"))
_gameManager.SetToNextCharacter(_gameManager.Players.ElementAt(0));
if (Input.IsActionJustPressed("p1_left"))
_gameManager.SetToPreviousCharacter(_gameManager.Players.ElementAt(0));
if (Input.IsActionJustPressed("p1_right"))
_gameManager.SetToNextCharacter(_gameManager.Players.ElementAt(0));
if (Input.IsActionJustPressed("p1_left"))
_gameManager.SetToPreviousCharacter(_gameManager.Players.ElementAt(0));
if (Input.IsActionJustPressed("p1_fire"))
{
GD.Print("Selected character");
_gameManager.Players.ElementAt(0).IsSelectingCharacter = false;
var wheel1 = GetNode<TextureRect>("CharacterSelect/Wheel");
wheel1.Hide();
EmitSignal(SignalName.OnCharacterSelectionMade, _gameManager.Players.ElementAt(0));
}
if (Input.IsActionJustPressed("p1_fire"))
{
GD.Print("Selected character");
_gameManager.Players.ElementAt(0).IsSelectingCharacter = false;
var wheel1 = GetNode<TextureRect>("CharacterSelect/Wheel");
wheel1.Hide();
EmitSignal(SignalName.OnCharacterSelectionMade, _gameManager.Players.ElementAt(0));
GetTree().Paused = false;
}
}
if (_gameManager.Players.Count() == 2 && player == _gameManager.Players.ElementAt(1))
if (_gameManager.Players.Count() == 2 && _gameManager.Players.ElementAt(0).IsSelectingCharacter)
{
if (Input.IsActionJustPressed("p2_right"))
_gameManager.SetToNextCharacter(_gameManager.Players.ElementAt(1));
if (Input.IsActionJustPressed("p2_left"))
_gameManager.SetToPreviousCharacter(_gameManager.Players.ElementAt(1));
if (Input.IsActionJustPressed("p2_fire"))
{
if (Input.IsActionJustPressed("p2_right"))
_gameManager.SetToNextCharacter(_gameManager.Players.ElementAt(1));
if (Input.IsActionJustPressed("p2_left"))
_gameManager.SetToPreviousCharacter(_gameManager.Players.ElementAt(1));
if (Input.IsActionJustPressed("p2_fire"))
{
GD.Print("Selected character");
_gameManager.Players.ElementAt(1).IsSelectingCharacter = false;
var wheel2 = GetNode<TextureRect>("CharacterSelect/Wheel2");
wheel2.Hide();
EmitSignal(SignalName.OnCharacterSelectionMade, _gameManager.Players.ElementAt(1));
}
GD.Print("Selected character");
_gameManager.Players.ElementAt(1).IsSelectingCharacter = false;
var wheel2 = GetNode<TextureRect>("CharacterSelect/Wheel2");
wheel2.Hide();
EmitSignal(SignalName.OnCharacterSelectionMade, _gameManager.Players.ElementAt(1));
GetTree().Paused = false;
}
}
}