Fix game over
This commit is contained in:
@@ -7,7 +7,7 @@ public partial class Character : CharacterBody3D
|
||||
[Export]
|
||||
protected PackedScene _altFireProjectile;
|
||||
|
||||
protected Player _ownerPlayer;
|
||||
public Player OwnerPlayer;
|
||||
|
||||
[Export]
|
||||
protected float _speed = 3.0f;
|
||||
@@ -24,7 +24,7 @@ public partial class Character : CharacterBody3D
|
||||
|
||||
public void Initialize(Player ownerPlayer)
|
||||
{
|
||||
_ownerPlayer = ownerPlayer;
|
||||
OwnerPlayer = ownerPlayer;
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
@@ -38,9 +38,9 @@ public partial class Character : CharacterBody3D
|
||||
if (Input.IsActionJustPressed("exit"))
|
||||
GetTree().Quit();
|
||||
|
||||
if (Input.IsActionJustPressed(_ownerPlayer.PlayerInput.Fire()) && CanShoot)
|
||||
if (Input.IsActionJustPressed(OwnerPlayer.PlayerInput.Fire()) && CanShoot)
|
||||
Fire();
|
||||
if (Input.IsActionJustPressed(_ownerPlayer.PlayerInput.AltFire()) && CanShoot)
|
||||
if (Input.IsActionJustPressed(OwnerPlayer.PlayerInput.AltFire()) && CanShoot)
|
||||
AltFire();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public partial class Character : CharacterBody3D
|
||||
{
|
||||
var velocity = Velocity;
|
||||
|
||||
var inputDir = Input.GetVector(_ownerPlayer.PlayerInput.Left(), _ownerPlayer.PlayerInput.Right(), _ownerPlayer.PlayerInput.Up(), _ownerPlayer.PlayerInput.Down());
|
||||
var inputDir = Input.GetVector(OwnerPlayer.PlayerInput.Left(), OwnerPlayer.PlayerInput.Right(), OwnerPlayer.PlayerInput.Up(), OwnerPlayer.PlayerInput.Down());
|
||||
var direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
|
||||
if (direction != Vector3.Zero)
|
||||
{
|
||||
@@ -89,6 +89,6 @@ public partial class Character : CharacterBody3D
|
||||
public void OnHit(Node3D node)
|
||||
{
|
||||
if (this != null)
|
||||
_gameManager.CallDeferred(GameManager.MethodName.RemoveCharacter, _ownerPlayer);
|
||||
_gameManager.CallDeferred(GameManager.MethodName.RemoveCharacter, OwnerPlayer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user