7-15-25@3:02am
This commit is contained in:
@@ -6,9 +6,9 @@ public partial class Cue : Sprite2D
|
||||
[Signal]
|
||||
public delegate void ShootEventHandler(Vector2 IMPULSE);
|
||||
|
||||
public bool _shown;
|
||||
public int _powerDirection = 1;
|
||||
public float _power = 0.0f, _maxPower = 8.0f;
|
||||
public bool _donned = false, _equiped = false, _sending = false;
|
||||
public float _power = 0.0f, _maxPower = 20.0f;
|
||||
Vector2 _direction;
|
||||
public ProgressBar _progressBar;
|
||||
|
||||
public static Cue Create(string SCENENAME)
|
||||
@@ -24,51 +24,66 @@ public partial class Cue : Sprite2D
|
||||
{
|
||||
//_progressBar = GetParent().GetNode<ProgressBar>("PowerBar");
|
||||
}
|
||||
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
{
|
||||
Vector2 mousePosition = GetViewport().GetMousePosition();
|
||||
LookAt(mousePosition);
|
||||
if (Input.IsActionPressed("left_click"))
|
||||
|
||||
if (!_sending)
|
||||
{
|
||||
_power += 0.1f * _powerDirection;
|
||||
if (_power >= _maxPower)
|
||||
Vector2 mousePosition = GetViewport().GetMousePosition();
|
||||
Offset = new Vector2(_power * -10, 0);
|
||||
LookAt(mousePosition);
|
||||
if (Input.IsActionJustPressed("scroll_down"))
|
||||
{
|
||||
_powerDirection = -1;
|
||||
_power = Math.Min(_power + (1f * (Input.IsActionPressed("shift") ? 5 : 1) / (Input.IsActionPressed("ctrl") ? 10 : 1)), _maxPower);
|
||||
}
|
||||
else if (_power <= 0)
|
||||
else if (Input.IsActionJustPressed("scroll_up"))
|
||||
{
|
||||
_powerDirection = 1;
|
||||
_power = Math.Max(_power - (1f * (Input.IsActionPressed("shift") ? 5 : 1) / (Input.IsActionPressed("ctrl") ? 10 : 1)), 0);
|
||||
}
|
||||
|
||||
if (Input.IsActionJustReleased("left_click"))
|
||||
{
|
||||
if (_power > 0f)
|
||||
{
|
||||
_sending = true;
|
||||
_direction = mousePosition - Position;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_power > 0f)
|
||||
if (Offset.X < 0)
|
||||
{
|
||||
_powerDirection = 1;
|
||||
Vector2 direction = mousePosition - Position;
|
||||
EmitSignal(SignalName.Shoot, _power * direction);
|
||||
Offset = new Vector2(Math.Min(0, Offset.X + _power * 2), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_sending = false;
|
||||
Offset = Vector2.Zero;
|
||||
EmitSignal(SignalName.Shoot, _power * _direction);
|
||||
_power = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void HideCue()
|
||||
public void Doff()
|
||||
{
|
||||
_shown = false;
|
||||
_donned = false;
|
||||
SetProcess(false);
|
||||
Hide();
|
||||
//_progressBar.Hide();
|
||||
}
|
||||
|
||||
public void ShowCue(Ball CUEBALL)
|
||||
|
||||
public void Don(Ball CUEBALL)
|
||||
{
|
||||
_shown = true;
|
||||
SetProcess(true);
|
||||
_donned = true;
|
||||
Position = CUEBALL.Position;
|
||||
//_progressBar.Position = new Vector2(CUEBALL.Position.X - _progressBar.Size.X / 2, CUEBALL.Position.Y + _progressBar.Size.Y / 2);
|
||||
SetProcess(true);
|
||||
Show();
|
||||
//_progressBar.Position = new Vector2(CUEBALL.Position.X - _progressBar.Size.X / 2, CUEBALL.Position.Y + _progressBar.Size.Y / 2);
|
||||
//_progressBar.Show();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user